Wrap up

Summary

  • while repeats code for as long as a condition is True

  • for repeats code for a specific number of iterations

  • range lets us control the start, end, and step size of a for loop

  • You can solve many problems by updating a variable at each step in a loop

    • total and average
    • maximum and minimum
    • finding and filtering
  • You can debug loops using print, or by stepping through the code with a debugger like pythontutor

How was this lesson?