PygLatin; Ending Up


#1


Enter a word: abc
bcaay
abc
None

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




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
print new_word[1:len(new_word)]
print original
else:
print 'empty'


#2

Hi @objectmaster81425,

Instead of this ...

print new_word[1:len(new_word)]
print original

... you need to assign that final slice to new_word and display that.


#3

Can you tell me how to assign the final slice ?

i am doin

new_word[1: len(new_word)]
also tried
new_word[1 :]

its says Oops, try again. It looks like new_word contains "abcaay" instead of "bcaay"!

when i am not printing the new_word

& when i am printing the new_word error changes to this

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


#4

hi, you see thats the problem I dont know how to slice or get a way out of this program


#5

Following is a pattern for computing and displaying the result for this exercise ...

    new_word = word + first + pyg
    # Assign the final slice to new_word
    new_word = new_word[1:len(new_word)]
    print new_word

#6

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