Testing, Testing, is This Thing On? [help]


#1



Testing, Testing, is This Thing On?


Traceback (most recent call last):
File "python", line 5, in
IndexError: string index out of range


my code works except for when I don't enter any word and the error below pops up. If I add numbers it will print 'Only Letters!!!'
If I add a word it translates it properly

Replace this line with your code. 
pyg = 'ay'

original = raw_input('Enter a word:')
word = (original).lower() 
first = word[0]
new_word = word + first + pyg
new_word = new_word[1:len(new_word)]

if len (original) > 0 and original.isalpha():
    print new_word
else:
    print 'only leters!!!'


#2

if you don't enter anything, here:

first = word[0]

you can't access index zero, because there isn't a index zero

when you enter a number, isalpha will be false

what is your question?


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.