if, elif, and else 🌿Learning Target: I can use if, elif, and else statements to make decisions in Python.
score = 85
if score >= 90:
print("Grade: A")
elif score >= 80:
print("Grade: B")
else:
print("Grade: C or below")
Write a program that asks the user for their score and prints their grade using if, elif, and else.
Try it here:
Learning Target: I can use nested and compound conditions to make complex decisions in Python.
coins = 5
level = 3
if coins > 0 and level >= 3:
print("You can unlock the bonus round!")
Write a program that checks if a user has enough coins and is at a high enough level to unlock a bonus round.
Try it here:
while Loop 🔁Learning Target: I can use a while loop to repeat actions in Python.
points = 0
while points < 10:
print("Keep going!")
points += 2
Write a program that uses a while loop to count from 0 to 10, printing a message each time.
Try it here:
for Loop 🔄Learning Target: I can use a for loop to repeat actions in Python.
for i in range(1, 6):
print("Level", i)
Write a program that uses a for loop to print the levels from 1 to 5.
Try it here:
break, continue, pass ⏭️Learning Target: I can use break, continue, and pass to control loops in Python.
for coin in ["Gold", "Silver", "Platinum"]:
if coin == "Platinum":
continue
print("You have a", coin)
Write a program that uses break, continue, and pass to control the flow of a loop.
Try it here:
Learning Target: I can use nested loops to perform repeated actions in Python.
for level in range(1, 4):
for item in ["Sword", "Shield"]:
print(f"Level {level}: {item}")
Write a program that uses nested loops to print items for each level.
Try it here: