PygLatin

Lesson 01/11 – Break It Down

[code lang=”python”]

[/code]

Lesson 02/11 – Ahoy! (or Should I Say Ahoyay!)

[code lang=”python”]
print ("Welcome to the English to Pig Latin translator!")
[/code]

Lesson 03/11 – Input!

[code lang=”python”]
print ("Welcome to the English to Pig Latin translator!")
original = raw_input(‘Please digit a word here’)
[/code]

Lesson 04/11 – Check Yourself!

[code lang=”python”]
print ("Welcome to the English to Pig Latin translator!")
original = raw_input(‘Please digit a word here’)
if original == "":
    print ("empty")
else:
    print (original)
[/code]

Lesson 05/11 – Check Yourself… Some More

[code lang=”python”]
print ("Welcome to the English to Pig Latin translator!")
original = raw_input(‘Please digit a word here’)
if original.isalpha():
    print (original)
else:
    print ("empty")
[/code]

Lesson 06/11 – Pop Quiz!

[code lang=”python”]
print ("Welcome to the English to Pig Latin translator!")
original = raw_input(‘Please digit a word here’)
if original.isalpha():
    print (original)
else:
    print ("empty")
[/code]

Lesson 07/11 – Ay B C

[code lang=”python”]
pyg = "ay"
[/code]

Lesson 08/11 – Word Up

[code lang=”python”]
pyg = ‘ay’

original = raw_input(‘Enter a word:’)

if len(original) > 0 and original.isalpha():
    print original
    word = original.lower()
    first = word[0]
else:
    print ’empty’
[/code]

Lesson 09/11 – Move it on Back

[code lang=”python”]
pyg = ‘ay’

original = raw_input(‘Enter a word:’)

if len(original) > 0 and original.isalpha():
    word = original.lower()
    first = word[0]
    if first == "a" or first == "e" or first == "i" or first == "o" or first == "u":
        new_word = word + pyg
        print new_word
    else:
        print "consonant"
else:
    print ’empty’
[/code]

Lesson 10/11 – Ending Up

[code lang=”python”]
pyg = ‘ay’

original = raw_input(‘Enter a word:’)

if len(original) > 0 and original.isalpha():
    word = original.lower()
    first = word[0]
    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:] + first + pyg
        print new_word
else:
    print ’empty’
[/code]

Lesson 11/11 – Testing, Testing, is This Thing On?

[code lang=”python”]
pyg = ‘ay’

original = raw_input(‘Enter a word:’)

if len(original) > 0 and original.isalpha():
    word = original.lower()
    first = word[0]
    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:] + first + pyg
        print new_word
else:
    print ’empty’
[/code]

One thought on “PygLatin

Leave a Reply

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

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax