Docsity

CODEHS UNIT 3 PROGRAMMING WITH PYTHON (PYTHON) QUESTIONS WITH COMPLETE ANSWERS (100% ACCUR, Exams of Programming Paradigms

Toggle sidebar
bg1
CODEHS UNIT 3 PROGRAMMING WITH PYTHON
(PYTHON) QUESTIONS WITH COMPLETE ANSWERS
(100% ACCURATE)
Question 1.
3.3.4: Your Name and Hobby
ANSWER
# This program should print out your
# name, and a hobby you have
# Sample output:
#
# My name is Jeremy
# I like to juggle
#
print("My name is Daniel")
print("I like to play video games")
Question 2.
3.4.6: Apples and Oranges
ANSWER
# Enter your code here
num_apples = 20
print("Number of apples: " + str(num_apples))
num_oranges=15
print("Number of oranges: " + str(num_oranges))
num_apples=20
print("Number of apples: " + str(num_apples))
num_oranges=0
print("Number of oranges: " + str(num_oranges))
i.
ii.
iii.
iv.
v.
vi.
vii.
viii.
ix.
i.
ii.
iii.
iv.
v.
vi.
vii.
viii.
ix.
1 / 4
pf3
pf4

Partial preview of the text

Download CODEHS UNIT 3 PROGRAMMING WITH PYTHON (PYTHON) QUESTIONS WITH COMPLETE ANSWERS (100% ACCUR and more Exams Programming Paradigms in PDF only on Docsity!

CODEHS UNIT 3 PROGRAMMING WITH PYTHON

(PYTHON) QUESTIONS WITH COMPLETE ANSWERS

(100% ACCURATE)

Question 1.

3.3.4: Your Name and Hobby

ANSWER

This program should print out your

name, and a hobby you have

Sample output:

My name is Jeremy

I like to juggle

print("My name is Daniel") print("I like to play video games")

Question 2.

3.4.6: Apples and Oranges

ANSWER

Enter your code here

num_apples = 20 print("Number of apples: " + str(num_apples)) num_oranges= print("Number of oranges: " + str(num_oranges)) num_apples= print("Number of apples: " + str(num_apples)) num_oranges= print("Number of oranges: " + str(num_oranges))

i. ii. iii. iv. v. vi. vii. viii. ix.

i. ii. iii. iv. v. vi. vii. viii. ix.

Question 3.

3.5.4: Obi-Wan Says

ANSWER

Place your code here

name = input("What is your name?") droids= int(input("How many droids would you like to meet?")) wookies= int(input("How many wookies would you like to meet?")) print("Hi "+ name + ", you want to meet " + str(droids) + " droids and " + str(wookies) + " Wookies.")

Question 4.

3.6.7: Sporting Goods Shop

ANSWER

Enter your code here

COST_OF_FRISBEES = 15 amount = int(input("How many Frisbees would you like to buy?")) cost= (COST_OF_FRISBEES * amount) print("The cost for " + str(amount) + " frisbees is $" + str(cost) + " dollars.")

Question 5.

3.6.8: Running Speed

ANSWER

Enter your code here

miles= float(input("How many miles did you run?")) minutes= float(input("How many minutes did it take you?")) MINUTES_PER_HOUR = 60 mPH = MINUTES_PER_HOUR * miles / minutes print("Speed in MPH: " + str(mPH))

i. ii. iii. iv. v.

i. ii. iii. iv. v.

i. ii. iii. iv. v. vi.

center_x = get_width() / 2 bottom_ball = Circle(BOTTOM_RADIUS / 2) bottom_ball.set_position(center_x, get_height() * 2/3) bottom_ball.set_color(Color.grey) add(bottom_ball) middle_ball = Circle(MID_RADIUS / 2) middle_ball.set_position(center_x, get_height() /2) middle_ball.set_color(Color.grey) add(middle_ball) top_ball = Circle(TOP_RADIUS / 2) top_ball.set_position(center_x, get_height() / 2.45) top_ball.set_color(Color.grey) add(top_ball)

Question 9.

3.8.5 Click for Rectangles

ANSWER RECT_HEIGHT = 50 RECT_WIDTH = 30 def draw_rectangle(x, y): rectangle = Rectangle(50, 30) rectangle.set_position(x, y) add(rectangle) add_mouse_click_handler(draw_rectangle)

Question 10.

Link for google drive containing pictures of the code.

ANSWER https://drive.google.com/drive/fold- ers/1pN_SDmC0Wi51NytrGNC2IBOI5FeIcopC?usp=sharing

vi. vii. viii. ix. x. xi. xii. xiii. xiv. xv. xvi. xvii. xviii.

i. ii. iii. iv. v. vi. vii.