DLT:
  • Use conditionals to react to changes in variables and sprite properties
  • Use Python commands and conditional loops to solve puzzle modules
  • Identify differences between a "for" loop and a conditional "while" loop
  • Use "while" loops to continue executing code while a condition is true
  • Identify differences between a "for" loop and a "while" loop
  • Use the "break" command to stop a loop from iterating before it ends naturally

Vocabulary:
  • Boolean Expression - in programming, an expression that evaluates to True or False.
  • Condition - Something a program checks to see whether it is true before deciding to take an action.
  • Conditionals - Statements that only run when certain conditions are true.
  • "While" Loop: A "while" loop checks whether a condition is true before it executes the code inside it. The "while" loop in Python has the following syntax:

  • "Break" Statement: A "break" statement will stop a loop from iterating before it ends naturally.
  • Infinite Loop: An infinite loop is a loop that will never stop until the program is stopped. Generally, you need to make sure any loop has an end condition that it is possible to reach. For example, the following piece of code would cause an infinite loop:

    while (4 == 4) :

    print(‘hi’)

Activity:

  • Tynker Python: Conditional Loops - This introduction to "while" loops builds on what you have learned about loops, booleans, conditionals, and comparison operators. Conditional loops like "while" loops check whether a condition evaluates to true and continue executing the code while the condition is true. Due by end of class.
  • Prototype This: Get Up and Go