Pyg latinnnnnnnnnnn HELP


#1



print 'Welcome to the Pig Latin Translator!'

Start coding here!

original = raw_input("Enter a word:")
if len(original) > 0:
print original
else len(original) < 0:
print ("empty")


Im stuck on this :confused:


#3

else can't have a condition since it is everything else

this is python2, print shouldn't have parentheses.


#6

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
word = original.lower()
first = word[0]
if first == "a" or first == "e" or first == "i" or first == "o" or first == "u":
new_word = word + pyg
print new_word
else:
print "consonant"
else:
print 'empty'


#11

You can use slice methods on string:

#Pig Latin game

word = raw_input()
print 'Enter a word in English: '
if word == '' and word.isalpha():
    print("You entered nothing.")
else:
    word = word[1:] + word[-1] + 'ay'
    print word

or

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'

#12

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