📚 node [[python loops while loops]]

Python Loops - While Loops

Go to the [[Python Week 3 Main Page]] or the [[Python - Main Page]] Also see the [[Programming Main Page]] or the [[Main AI Page]]

Also see [[Python Loops - For Loops]]

For code examples see the [[Week3 Python For and While Loops Lab]]

While Loops

A loop that executes so long as a condition is met.

A graphic representation of a while loop

Syntax

while medici_family == True:
	sc_recruit(medici)

Or, if you want a counter.

medici_family = [ ... ]

sc_recruit = []

i = 0

while medici_family[i]:
	sc_recruit.append(medici)
	i += 1
📖 stoas
⥱ context