My First Python program “Pyg Latin Translator”

Just finished creating my first program on Code Academy called “An English to Pyg Latin Translator” while learning Python programming language.

What it does?

From Codecademy: Pyg Latin is basically a language where we take the first letter of a word and put it on the end while also adding a vowel sound. So dog becomes “ogday”.

Here is the code I wrote in a step by step process:

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' or first == 'A' or first == 'E' or first == 'I' or first == 'O' or first == 'U'):  
        new_word = word + pyg
        print new_word
    	new_word = word[1:] + word[0] + pyg
        print new_word
	print 'You have not entered a valid word. (Alphabetical Characters only!).'

This program lacks commenting as of now, however, considering the simplicity of the program, commenting might not be even required as of now.

Its definitely fun, working out a logical structure (an algorithm / a flow) for a particular program and then starting to code small parts of a program, that ultimately when combined result into a fully functional program.

Posted in Code Academy, Fun with Python | Tagged , , , , , , , , , , , , , , , , , | 4 Comments