PygLatin - Move it on back


#1

Here's my code so far:

original = raw_input('Enter a word:')
pyg = 'ay'

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

When I run the code, the terminal gives me:

Enter a word: python
python
None

Why won't the program give me a new word? Is there something wrong with the variables below?


#2

@codecadet101: You're not actualling printing the new_word.
Use

print new_word

And things should work just fine.


#3

@g4be : but according to the problem the first letter of the word should be stripped.

new = word.strip(original[0])
first = word[0]
new_word = new + first + pyg
print new_word

#4

@san.deep: Stripping the first, second, nth letter of a string and printing it, which in this case is in new_word, are quite different.


#5

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