Use 'while' and 'for' loops in Python


With Python, you can use while loops to run the same task multiple times and for loops to loop once over list data. In this module, you'll learn about the two loop types and when to apply each.

Learning objectives

After you've completed this module, you'll be able to:

  • Identify when to use while and for loops.
  • Run a task multiple times by using while loops.
  • Loop over list data by using for loops.


  • Basic Python programming knowledge, including the use of variables, strings, integers, and math.
  • Experience working with lists in Python.
  • Experience modifying and running code in Jupyter notebooks.