Help in Pyglatin


#1

This is my Pyglatin code:

pyg='ay'
original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
print original
word = original.lower();
first = word[0];
new_word = [1:len(new_word)];
else:
 print 'empty'`

when I try to run this code it shows:
File "python", line 9
new_word = [1:len(new_word)];
^
SyntaxError: invalid syntax
please help!


#2

Look how you are finding a character at index 0 in line 7:

first = word[0]

In the next line you don't have any string to index. But that's not the only problem. You are also trying to input length of new_word that you are declaring at this line. That line should read something in the sense of:

new_word = word[1:len(word)]

And you don't have to use semicolons.


#3

So what can I do, at least can you send me the answer?


#4

pyg = 'ay'
original = raw_input('Enter a word:')
word = original
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 'empty'
Here is the code,which shows no mistake