python smyčky
#x starts at 1 and goes up to 80 @ intervals of 2
for x in range(1, 80, 2):
print(x)
jak používat pro smyčky python
#simple for loop to print numbers 1-99 inclusive
for i in range(1,100):
print(i)
#simple for loop to loop through a list
fruits = ["apple","peach","banana"]
for fruit in fruits:
print(fruit)
Jak mohu udělat pro smyčku v Pythonu
for i in range(0, 10):
#do stuff
pass
pro smyčku v Pythonu
data = [34,56,78,23]
sum = 0
# for loop is to iterate and do same operation again an again
# "in" is identity operator which is used to check weather data is present or not
for i in data:
sum +=i
print(sum)