I tried to enhance it to include all the rules but I'm getting an error message on the else statement


#1
pyg = 'ay'

original = raw_input('Enter a word: ')

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

#2

what error do you get? Can you give me the exact error message

the only error message i get when i run your code is an indent one, fixing the indent will make the code work:

https://repl.it/@stetim94/DarkgreyPoliticalHeron


#4

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