Need help with Ending Up code


#1



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


Oops, try again. It looks like you printed the correct translation of "shamman", but make sure to set new_word equal to the slice as well.


to be honest i do not know !!


pyg = 'ay'

original = raw_input('Enter a word:')

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


#2

Your code

pyg = 'ay'

original = raw_input('Enter a word:')

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

Lets test your code by providing it input and matching it with desirable output

Lets run your code by putting the input.
Lets say I input : python

After this code:

pyg = 'ay'

original = raw_input('Enter a word:')

1.You check that length of string is greater than 0 and if it is consists of alphabetic letters.
as our input is python ,it satisfies both of your conditions

2.You converted the input in lower case and stored in variable word.

3.You stored first letter of word that is p in variable first

4.You sliced the word leaving first letter.
This returns you ython

5.But you did not do this!

Reassign the whole thing to new_word

what is this whole thing?
new_word + first + pyg

6.then print the new_word

I hope this hint helps ya! :slight_smile:
Do tell if it solved your problem! :slight_smile:


#3

thanks alot for the fast replay and thanks for your time, i will check it right now and sorry about my noobeness xD


#4

You're welcome! :slight_smile:

sorry about my noobeness xD

haha, Nope!! you're not a noob! Keep up the good work! :thumbsup:


#5

i am so happy that the problem been solved by simple fast advice. Thanks a lot for you and thanks a lot for the nice python community that are helping people like me


#6

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