Python: Lists and Dictionaries (2/14)


#1
numbers = [5, 6, 7, 8]

print "Adding the numbers at indices 0 and 2..."
print numbers[0] + numbers[2]
print "Adding the numbers at indices 1 and 3..."
phones = ['Apple', 'Samsung', 'Nokia', 'Blackberry']
print phones[1], phones[3]

Error: “Remember: the second item will have an index of 1. Make sure to access the second item by its index!”

Note: The console does show the 2nd and 4th item on the list.


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.