add to list python for loop code example
Example 1: append in a for loop python
a=[]
for i in range(5):
a.append(i)
a # the list with the new items.
Example 2: loop append to list python
a=[]
for i in range(5):
a.append(i)
print(a)
# [0, 1, 2, 3, 4]