For loops in Python are easy 🔁In python tutorial

Publicado el: 13 noviembre 2022
en el canal de: NitCode
12
3

00:00:00 iterate forwards
00:01:39 iterate backwards
00:02:15 step
00:02:44 iterate over a string
00:03:26 continue
00:04:19 break
00:04:35 conclusion

for loops = execute a block of code a fixed number of times.
You can iterate over a range, string, sequence, etc.

------------- EXAMPLE 1 -------------

for x in range(1, 11):
print(x)

------------- EXAMPLE 2 -------------

for x in reversed(range(1, 11)):
print(x)

print("Happy New Year!")

------------- EXAMPLE 3 -------------

for x in range(1, 11, 2):
print(x)

------------- EXAMPLE 4 -------------

credit_card = "1234-5678-9012-3456"

for x in credit_card:
print(x)

------------- CONTINUE -------------

for x in range(1, 21):
if x == 13:
continue
else:
print(x)

------------- BREAK -------------

for x in range(1, 21):
if x == 13:
break
else:
print(x


En esta página del sitio puede ver el video en línea For loops in Python are easy 🔁In python tutorial de Duración hora minuto segunda en buena calidad , que subió el usuario NitCode 13 noviembre 2022, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 12 veces y le gustó 3 a los espectadores. Disfruta viendo!