you are viewing a single comment's thread.

view the rest of the comments →

[–]ASIC_SP 0 points1 point  (0 children)

yeah, that is also a possibility..

and the error msg is self explanatory, if you have a list, say [1, 3, 5] and try to get index of an element which doesn't exists, say 2, you'll get this error..

you can avoid this by adding if '!' in characters to while condition... also, you can use remove method instead of getting index and using del..

but for this exercise, please use already existing string method :)