Skip to content

Instantly share code, notes, and snippets.

@rugk
Last active July 26, 2016 09:39
Show Gist options
  • Select an option

  • Save rugk/012a68c0fe559e942d22 to your computer and use it in GitHub Desktop.

Select an option

Save rugk/012a68c0fe559e942d22 to your computer and use it in GitHub Desktop.
Codeacademy - Python course: Pig Latin (PygLatin) https://www.codecademy.com/learn/python
# constants
pyg = 'ay'
# input
original = raw_input('Enter a word:')
# check for errors
if len(original) > 0 and original.isalpha():
print original
else:
raise ValueError('invalid input')
# process input
word = original.lower()
first = word[0]
slipped_word = word[1:]
# new word: previous word without first char + first char + pyg ending
new_word = slipped_word + first + pyg
#output
print new_word
@abenmariem
Copy link
Copy Markdown

abenmariem commented Jul 26, 2016

thanks for the great help.
your tutorial is very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment