LAB: 4

Pyg Latin:

applying the knowledge and skill  learned in the previous labs including Variables ,if,else,control flow etc to create a Pyg Latin translator.

(under construction)

code:

pyg = 'ay'

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

 

Screenshots:

pyg

Leave a Reply

Your email address will not be published. Required fields are marked *