Docsity

CodeHs Unit 4 Python Control Structures (PYTHON) 2026-2027. Questions & Answers. Graded A, Exams of Computer Science

Toggle sidebar
bg1
CodeHs Unit 4 Python Control
Structures (PYTHON) Latest 2026-
2027. Questions & Correct Verified
Answers. Graded A
4.2.6: Can You Graduate? - ANS# Enter your code here
has_enough_units = True
has_met_requirements = True
can_graduate= has_enough_units and has_met_requirements
print("Can you graduate? " + str(can_graduate))
4.3.5: Rolling Dice - ANS# Enter your code here
first_die = int(input("What was the value on the first die? "))
second_die = int(input("What was the value on the second die? "))
rolled_doubles = first_die == second_die
print("The value on the first die is " + str(first_die ))
print("The value on the second die is " + str(second_die))
print("Rolled doubles? " + str(rolled_doubles))
4.4.7: Teenagers - ANS# Enter your code here
age = int(input("What is your age? "))
if age >= 13 and age <= 19:
print("Yes, you are a teenager.")
pf3

Partial preview of the text

Download CodeHs Unit 4 Python Control Structures (PYTHON) 2026-2027. Questions & Answers. Graded A and more Exams Computer Science in PDF only on Docsity!

CodeHs Unit 4 Python Control

Structures (PYTHON) Latest 2026-

2027. Questions & Correct Verified

Answers. Graded A

4.2.6: Can You Graduate? - ANS# Enter your code here has_enough_units = True has_met_requirements = True can_graduate= has_enough_units and has_met_requirements print("Can you graduate? " + str(can_graduate)) 4.3.5: Rolling Dice - ANS# Enter your code here first_die = int(input("What was the value on the first die? ")) second_die = int(input("What was the value on the second die? ")) rolled_doubles = first_die == second_die print("The value on the first die is " + str(first_die )) print("The value on the second die is " + str(second_die)) print("Rolled doubles? " + str(rolled_doubles)) 4.4.7: Teenagers - ANS# Enter your code here age = int(input("What is your age? ")) if age >= 13 and age <= 19: print("Yes, you are a teenager.")

else: print("No, you are not a teenager.") 4.5.4 Growing Circle - ANS# Start coding here. Don't forget to click the canvas

before you try to use the arrow keys!

radius = 100 def key_down(event): if event.key == "ArrowLeft": circle.get_radius(radius - 10) if event.key == "ArrowRight": circle.set_radius(radius + 10) circle = Circle(100) circle.set_position(250,250) add(circle) add_key_down_handler(key_down) 4.6.4: Meme Text Generator - ANS# Enter your code here for i in range(50): print("Takes one political science class. Knows how to solve the world's problems.") 4.7.5: Count By Sevens - ANS# Enter your code here for i in range(0,500,7): print(i)