+ 1
Why is this index out of range?
I’ve been trying to solve the Pig Latin puzzle in Python. For the life of me I can not figure out how I keep getting an index out of range error Inside my while loop. Can someone please explain? nonpig = str(input("")) pig = [] first = "" nono = [nonpig.split()] i = 0 while i <= len(nonpig): first = nono[0][i][0] pig += (nono[0][i][:2] + first + 'ay') i += 1 print (pig)
2 Antworten
0
Instead of i<=len(nonpig)
Put i<len(nonpig) and try...
But follow above @Oma's advise to get better answers..