2-10 ending up


#1

i don't know what with my code it's worked until now, but now i'm getting an error that says, Oops, try again. first should contain the first letter of word. and here I my code

pyg = 'ay'

original = raw_input('Enter a word:')
first = "orginal"[0]
word = original.lower()
new_word = word + first + pyg
new_word = new_word[0:len(new_word)]
if len(original) > 0 and original.isalpha():
print new_word

else:
print 'empty'


#2

Hello jtfire,

You haven't followed the exercise at all from the way your code is structured. Are you sure this is how your code should look like?

your if statement is in the wrong place, as well as the rest of your code except for the first two pyg and original variables. Read again properly from the beginning the exercises.

Lastly your first variable is declared wrong!
first = "original"[0]
you are treating original as a string which is incorrect, plus original shouldn't be stored in the variable first.

Hint: You must declare your if statement after the original variable
Let me know if you got it to work or you need further explanation!


#3

thank you for responding to my call for help is this how my code should look?

pyg = 'ay'

original = raw_input('Enter a word:')

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

if yes then I have to find out why the print command is invalid syntax. if not then another hint would be nice


#4

Hello jtfire,
Sorry for the late reply it was late night for me :smile: anyways your code looks good now! You just mispelled your slicing, if you take a closer look you will notice that it miss the closing ']'

new_word = new_word[1:len(new_word), add the ending ] and you'll be fine!

new_word = new_word[1:len(new_word)]

If you still need anything let me know :smile:


#5

ok thanks for the help:)