how to make a loop functoin in python code example
Example 1: python for loop
for x in range(10):
print(x)
// output: 1,2,3,...,10
for x in range(10, 20, 2):
print(x)
// output: 10, 12, 14, 16, 18, 20
list = [2, 3, "el"]
for x in list:
print(x)
// output: 2, 3, "el"
for _ in range(10):
print("a");
// Do the loop without using index
Example 2: python for loop
//x starts at 1 and goes up to 5 increasing by 2
for x in range(1,5,2):
print(x)