Ending up


#1

my code:
pyg = 'ay'
new_word = word + first + pyg

original = raw_input('Enter a word:')

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

and error File "python", line 12
new_word = [1:len(new_word)]
^
SyntaxError: invalid syntax

what did i do wrong ?


#2

it should be length of word, not new word.


#3

on line 12,

you are trying to find the length of a variable while defining it.

this should work:

new_word = word[1:len(word)]+ first + pyg

you should put that right after defining original, and print new_word if len(original) > 0 and original.isalpha()

Complete Code:


#4

I use this . but it says "It looks like you printed the correct translation of "lemon", but make sure to set new_word equal to the slice as well."


#5

my code worked this way, i typed in "empty" into console after submitting