2011-03-04, 06:05 PM
Okay, so I have a new assignment in class to write a program that translates a word into pig latin. From what I've seen by the examples, a word beginning with 2 consonants should be translated up to the first vowel and have the consonants that were removed appear in front of the "ay" but I have no clue how to get past the first. Any ideas?
Also @above:
Why do you use int(raw_input())? input() works just the same as that.
Code:
from string import *
word = raw_input("Enter the word you would like to have translated: ")
if word[0].lower == "a" or word[0].lower == "e" or word[0].lower == "i" or word[0].lower == "o" or word[0].lower == "u":
word = word + "-" + "ay"
print word
elif word[0].lower == "y":
if word[1] != "a" and word[1] != "e" and word[1] != "i" and word[1] != "o" and word[1] != "u":
word = word + "-" + "ay"
print word
elif word[1] == "a" or word[1] == "e" or word[1] == "i" or word[1] == "o" or word[1] == "u":
word = word[1:] + "-" + word[0] + "ay"
print word
elif word[0].lower != "a" or word[0].lower != "e" or word[0].lower != "i" or word[0].lower != "o" or word[0].lower != "u":
word = word[0:] + "-" + word[0] + "ay"
print wordAlso @above:
Why do you use int(raw_input())? input() works just the same as that.

