Why is my code giving error when I am not iterating over an integer?
info = [['Tina', 'Turner', 1939, 'singer'], ['Matt', 'Damon', 1970, 'actor'], ['Kristen', 'Wiig', 1973, 'comedian'], ['Michael', 'Phelps', 1985, 'swimmer'], ['Barack', 'Obama', 1961, 'president']]
last_names=[]
nm=0
for i in info:
last_names+=i[nm][1]
nm+=1
1939). This code is not doing what you think it is BTW, just changei[nm][1]toi[1]. - pigeonburger