VisuAlg Web

Repetições Contadas (com contador)

Em Python, repetições contadas usam for ... in range(...) .

Em Python, repetições contadas usam for ... in range(...).

Exemplo de códigoPython


print("Starting the laps...")
for i in range(1, 5+1, 1):
print("Completed lap number: ", i)
Exemplo de códigoPython


print("Countdown skipping by 2:")
# A negative step decreases the value instead of increasing it
for i in range(10, 0-1, -2):
print(i)
print("LAUNCH!")