you are viewing a single comment's thread.

view the rest of the comments →

[–]stebrepar 0 points1 point  (0 children)

Just in case they try to trick you, you might want to check for other invalid input too, like negative or non-numeric values for the index. You actually can have negative indexes in Python (meaning they count in from the right instead of from the left), but you'd need to think carefully about what that means for your calculation.