Skip to content

Instantly share code, notes, and snippets.

@JeffersGlass

JeffersGlass/indices.py Secret

Created Dec 3, 2020
Embed
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
You can’t perform that action at this time.