10.ending up - problem


#1



https://www.codecademy.com/courses/python-beginner-2W5v7/1/4?curriculum_id=4f89dab3d788890003000096#


Oops, try again. It looks like new_word contains "apaPAPAgiannispay" instead of "apagiannispay"!


instead of "apagiannispay"!

pyg = 'ay'

original = raw_input('Enter a word:')

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

    print new_word
else:
    print "empty"



with some changes i made and the help of the guy

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'


#2

Hi!
i have checked your code and look... on the line:
new_word = new_word[1:4]
you are commanding it to slice ANY word from 1 to 4... and we want to slice the word from 1 till the end... so consider instead using this piece of code on that line:
new_word = new_word[1:len(new_word)]
this will cut the word from the position 1 till the end no matter the word


#3

Also delete your:
print new_word
on the if statement and consider using
print original


#4

eyyyyyy thank you ma friend, i am noob :')


#5

you are welcome any time


#6

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