Python Language Loops

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9


As one of the most basic functions in programming, loops are an important piece to nearly every programming language. Loops enable developers to set certain portions of their code to repeat through a number of loops which are referred to as iterations. This topic covers using multiple types of loops and applications of loops in Python.


  • while <boolean expression>:
  • for <variable> in <iterable>:
  • for <variable> in range(<number>):
  • for <variable> in range(<start_number>, <end_number>):
  • for <variable> in range(<start_number>, <end_number>, <step_size>):
  • for i, <variable> in enumerate(<iterable>): # with index i
  • for <variable1>, <variable2> in zip(<iterable1>, <iterable2>):


boolean expressionexpression that can be evaluated in a boolean context, e.g. x < 10
variablevariable name for the current element from the iterable
iterableanything that implements iterations

Got any Python Language Question?