11. Testing, Testing, is this thing on?


#1



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


when i execute it, it says finished, but it doesn't actually translate.
e.g. if I enter the word asd, it will just copy the word without translating it.


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:] + first + pyg
    print original
else:
    print 'empty'


#2

you print original, but what does original contain? Yes, exactly, the original string entered by the user. Which variable contains the translated version? I would print that variable instead


#3

This line is also an altercation,

on the other side of [1: you need to include len(new_word) to form,

new_word = word[1:len(new_word)] + first + pyg


#4

it would be better yes, but you don't need to.


#5

Obviously this doesn't address word beginning with vowels and doesn't 'set' the new_word as per the request - but is there anything wrong with constructing it this way and avoiding the convoluted addition of new variables?

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
print original[1:]+original[0]+"ay"
else:
print 'empty'

Thanks!! :slight_smile:


#6

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