PygLatin

1234567891011

The pyglatin lab assignment have students utilize the use of conditionals in python to create a translator for pig latin through the usage of variables and conditionals. The idea is to make a pig latin translator in python where any english word typed in the console will come out. Using conditional commands, like pyg = ‘ay’ or word = original.lower(), a translator can be built to easily convert any english words that are typed in and check it if it has numbers.

Code used for Translator:

pyg = ‘ay’

original = raw_input(‘Enter a word:’)
word = original.lower()
first= word[0]
new_word = word[1:len(new_word)] + first + pyg
if len(original) > 0 and original.isalpha():
print new_word
else:
print ’empty’