But how do we succinctly tell someone to print 4 by referring to its index?
It depends on who you are talking to. If its a programmer, you can most likely assume that they know that lists/arrays start with index 0, however if its not a programmer, you might as well just ignore the fact when communicating to them that they start at index 0.
Saying: 'print the item with index one' is not succinct. I need a shorter way.
- Code: Select all
options = ['1) Play', '2) Options', '3) Exit']
If they want to select Play, they are going to insert 1, however the true value to call is 0, options. Since python takes input as a string, you can just check the string against a string value. However in a langauge like c++, where the input most likely would be an int, you would just subtract 1 from the users value to get the index.
Like Mekire said, you really didnt specify what exactly you are talking about, so its hard to pinpoint an example/explanation.