Answers for "how to iterate through a list of numbers in python"

4

how to iterate over a list in python

# Python list
my_list = [1, 2, 3]

# Python automatically create an item for you in the for loop
for item in my_list:
  print(item)
Posted by: Guest on June-03-2020
0

how to iterate through a list of numbers in python

a = [(1, u'abc'), (2, u'def')]
[i[0] for i in a]
# OUTPUT: 
[1, 2]
Posted by: Guest on April-30-2021

Code answers related to "how to iterate through a list of numbers in python"

Python Answers by Framework

Browse Popular Code Answers by Language