Stuck with the code


#1

pyg = 'ay'
original = raw_input('Enter a word:')
word = original.lower() 
#When it mentions to include in "if" statement, it means after the colon but underneath the if statement. Just make sure it is indented with 4 spaces.
if len(original) > 0 and original.isalpha():
    first = word[0]
    new_word = word + first + pyg
    print new_word[1:len(new_word)]

Code is not working, please help me out.


#2

That line should first inside your if statement.


#3

I tried this too but its not working too. Thank you for ur reply.


#4

It shows the below lines:

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


#5

There you are printing the literal expression. The SCT expects us to copy this slice back on to the variable.

new_word = ...
print new_word

A bit arbitrary, but rudimentary lessons can be like that. We get the best experience by humoring the author and following their instructions.


#6

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