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