I Hate CBT's

View Original

4.5.4 Growing Circle

Question: 4.2.6: Can You Graduate?

Answer: # Enter your code here

hasenoughunits = True

hasmetrequirements = True

cangraduate= hasenoughunits and hasmet_requirements

print(“Can you graduate? “ + str(can_graduate))

Question: # 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? “))

rolleddoubles = firstdie == 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))

Answer: 4.3.5: Rolling Dice

Question: # 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.”)

Answer: 4.4.7: Teenagers

Question: 4.5.4 Growing Circle

Answer: # 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)

addkeydownhandler(keydown)

Question: 4.6.4: Meme Text Generator

Answer: # Enter your code here

for i in range(50):

print(“Takes one political science class. Knows how to solve the world’s problems.”)

Question: 4.7.5: Count By Sevens

Answer: # Enter your code here

for i in range(0,500,7):

print(i)

Question: 4.9.6 Random Color Square

Answer: