


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



3.4.6: Apples and Oranges
ANSWER
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))
3.7.8 French Flag
ANSWER
width= get_width() / 3 height= get_height() blue_rect= Rectangle(width, height) blue_rect.set_color(Color.blue) blue_rect.set_position(1,1) add(blue_rect)
width = get_width() / height = get_height() red_rect= Rectangle(width, height) red_rect.set_color(Color.red) red_rect.set_position(250 ,1) add(red_rect)
i. ii. iii. iv. v. vi. vii. viii. ix.
i. ii. iii. iv. v. vi. vii. viii. ix. x. xi. xii. xiii. xiv.
3.6.7: Sporting Goods Shop
ANSWER
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.")
3.3.4: Your Name and Hobby
ANSWER
print("My name is Daniel") print("I like to play video games")
3.6.9: 24 vs. "24"
ANSWER
num_result = 24 + 24 print(num_result)
string_result = str(24) + str(24) print(string_result)
i. ii. iii. iv. v.
i. ii. iii. iv. v. vi. vii. viii. ix.
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)
3.6.8: Running Speed
ANSWER
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))
vi. vii. viii. ix. x. xi. xii. xiii. xiv. xv. xvi. xvii. xviii.
i. ii. iii. iv. v. vi.