Starter quiz

  • Which of the following Python expressions evaluates to `True`?
    • `10 > 5`  ✓
    • `apple` == `banana`
    • `3 + 2 < 3 - 2`
    • `10 <= 5`
  • Which Python code is used to create a block of code that will run based on whether something is True or False?
    • `print`
    • `else`
    • `if`  ✓
    • `input`
  • What is the output when the program is run? ```score = 7 if score > 5: print("score is greater than 5") else: print("score is not greater than 5")```
    • score is greater than 5  ✓
    • score is not greater than 5
  • Which logical operator in Python checks if two conditions are both True?
    • `not`
    • `or`
    • `and`  ✓
    • `=`
  • What will be the output of this Python code? ```is_raining = True is_cold = False if is_raining or is_cold: print("Stay indoors") else: print("You can go outside!")```
    • You can go outside!
    • Stay indoors.  ✓
    • An error message.
    • No output will be produced.
  • Arrange the following components of an if-else statement in the correct order.
    • 1
      `if`
    • 2
      condition:
    • 3
      code to execute if the condition is True
    • 4
      `else:`
    • 5
      code to execute if the condition is False
+