Created by Gökçe Uludoğan
for i in [1, 2, 3, 4]:
print(i)
1
2
3
4
for i in range(5):
print(i, end=', ')
for i in range(5, 10):
print(i, end=', ')
for i in range(2,8,2):
print(i, end=', ')
for i in range(5):
print(i, end=', ')
0, 1, 2, 3, 4,
for i in range(5, 10):
print(i, end=', ')
for i in range(2,8,2):
print(i, end=', ')
for i in range(5):
print(i, end=', ')
0, 1, 2, 3, 4,
for i in range(5, 10):
print(i, end=', ')
5, 6, 7, 8, 9,
for i in range(2,8,2):
print(i, end=', ')
for i in range(5):
print(i, end=', ')
0, 1, 2, 3, 4,
for i in range(5, 10):
print(i, end=', ')
5, 6, 7, 8, 9,
for i in range(2,8,2):
print(i, end=', ')
2, 4, 6,
rows = 5
# outer loop
for i in range(1, rows + 1):
# inner loop
for j in range(1, i + 1):
print("*", end=" ")
print('')
the outer loop: the number of rows print.
the inner loop: the total number of columns in each row.