for loops python
text = "Hello World"
for i in text:
print(i)
#Output
#H, e, l, l, o, , W, o, r, l, d
for i in range(10):
print(i)
#1, 2, 3, 4, 5, 6, 7, 8, 9, 10
for loops python
text = "Hello World"
for i in text:
print(i)
#Output
#H, e, l, l, o, , W, o, r, l, d
for i in range(10):
print(i)
#1, 2, 3, 4, 5, 6, 7, 8, 9, 10
python for loop
# Python for loop
for i in range(1, 101):
# i is automatically equals to 0 if has no mention before
# range(1, 101) is making the loop 100 times (range(1, 151) will make it to loop 150 times)
print(i) # prints the number of i (equals to the loop number)
for x in [1, 2, 3, 4, 5]:
# it will loop the length of the list (in that case 5 times)
print(x) # prints the item in the index of the list that the loop is currently on
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us