I ended up with this code for the Pyg Latin course. It works but if I don't enter a word I get this error:
Traceback (most recent call last):
File "python", line 6, in
IndexError: string index out of range
instead of 'You did not type a word or you typed numbers!'
what am I doing wrong? My code:
pyg = 'ay' original = raw_input('Enter a word:') word = original.lower() first = word new_word = word + first + pyg new_word = new_word[1:len(new_word)] if len(original) > 0 and original.isalpha(): print "Your word in Pig Latin is %s!" % new_word else: print 'You did not type a word or you typed numbers!'