PygLatin

I PygLatin Part 1

i. Break It Down 1/11
> Save and Submit
ii. Ahoy! (or Should I Say Ahoyay!) 2/11

print "Pig Latin"

iii. Input! 3/11

print 'Welcome to the Pig Latin Translator!'

# Start coding here!
original = raw_input ("Enter a word:")

ii. List Comprehension Syntax 5/18


iv. Check Yourself! 4/11

print 'Welcome to the Pig Latin Translator!'

# Start coding here!
original = raw_input ("Enter a word:")
if len(original) > 0 :
    print original
else:
    print "empty"

v. Check Yourself… Some More 5/11

print 'Welcome to the Pig Latin Translator!'

# Start coding here!
original = raw_input ("Enter a word:")
if len(original)  > 0 and original.isalpha() :
    print original
else:
    print "empty"

vi. Pop Quiz! 6/11
>Save and Submit

II PygLatin Part 2

i. Ay B C 7/11

pyg = 'ay'

ii. Word UP 8/11

pyg = 'ay'

original = raw_input('Enter a word:')

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

iii. Move it on Back 9/11

pyg = 'ay'

original = raw_input('Enter a word:')

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

new_word = word + first + pyg
print new_word

iv. Ending Up 10/11

pyg = 'ay'

original = raw_input('Enter a word:')

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

new_word = word + first + pyg

new_word = new_word[1:len(new_word)]

v. Testing, Testing, is This Thing On? 11/11
>Save and Submit

Advertisements

One thought on “PygLatin

  1. For the code you have posted here, I could never get it to work as you have it here. Instead it pushed me in a less than effective direction. I was stuck on this portion for a few minutes until I used your code and looked at what was going on. Here is what I came up with and it works properly in all situations where you put numbers in the “word” or if you put a normal word in.

    pyg = ‘ay’

    original = raw_input(‘Enter a word:’)

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

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s