Answers for "python loop through list print"

54

python loop through list

list = [1, 3, 6, 9, 12] 
   
for i in list: 
    print(i)
Posted by: Guest on June-25-2019
0

how to print list using for loop in python

list = [1,"bob",4,"life",5]
# with loop
for i in list:
    print(i)  
>>> 1
bob
4
life
5

x = [print(i) for i in list]
>>> 1
bob
4
life
5

# without loop
print(*list, sep = ", ")
>>> 1, bob, 4, life, 5

print(' '.join(map(str, list)))
>>> 1 bob 4 life 5
Posted by: Guest on August-06-2021

Code answers related to "python loop through list print"

Python Answers by Framework

Browse Popular Code Answers by Language