Pig latin


#1

pyg = 'ay'

original = raw_input('Enter a word:')

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


#2

Is this for 10. Ending Up in PygLatin?


#3

yes it end with error message wor should contain lowercase version of orginal


#4

This was my code that worked:

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

#5

what is wrong with my code


#6

i have seen my error it work perfectly thanks


#7

pyg = 'ay'

original = raw_input('Enter a word:')

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

The first three lines in bold should be moved to the bottom of your code, with 'original' being changed to 'new_word'.
word = "pyg" should be removed.
word = word.lower() should be changed to word = original.lower()


#8

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