×
Home Lesson 1 Lesson 2 Lesson 3 Lesson 4 Lesson 5 Lesson 6

Lesson 1: Branching with 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")

Your Turn!

Write a program that asks the user for their score and prints their grade using if, elif, and else.

Try it here:

Lesson 2: Nested and Compound Conditions

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!")

Your Turn!

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:

Lesson 3: Using a 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

Your Turn!

Write a program that uses a while loop to count from 0 to 10, printing a message each time.

Try it here:

Lesson 4: Using a for Loop

Learning Target

I can use the I can use a for loop to repeat actions in Python.

for i in range(1, 6):
      print("Level", i)

Your Turn!

Write a program that uses a for loop to print the levels from 1 to 5.

Try it here:

Lesson 5: Loop Control: 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)

Your Turn!

Write a program that uses break, continue, and pass to control the flow of a loop.

Try it here:

Lesson 6: Nested Loops

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}")

Your Turn!

Write a program that uses nested loops to print items for each level.

Try it here: