string comparison | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

string comparison

wrote this code to print the words that starts with letters greater than "g" but i keep getting an index error. what is the best way to resolve this https://code.sololearn.com/crM85XC69n2x/?ref=app

15th Jun 2018, 6:09 AM
Doe Dare Oladimeji
Doe Dare Oladimeji - avatar
3 Answers
15th Jun 2018, 6:22 AM
李立威
+ 1
whao! that way shorter and neater
15th Jun 2018, 6:35 AM
Doe Dare Oladimeji
Doe Dare Oladimeji - avatar
+ 1
but do you know why it gives the error, given that i used the same condition like you did, if var[index] > "g". just curious
15th Jun 2018, 6:43 AM
Doe Dare Oladimeji
Doe Dare Oladimeji - avatar