Skip to content

Instantly share code, notes, and snippets.

Created Dec 3, 2020
What would you like to do?
myList = ['a', 'b', 'c', 'd', 'e']
#Throws TypeError: list indices must be integers or slices, no float:
print (myList[4/2])
#Works fine:
print (myList[int(4/2)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment