Pyg Latin

pig latin

Pig Latin is a language game were you move the first letter of the word to the end and then append the suffix ‘ay’. We started the Pig Latin lab by  typing print “Pig Latin”, then hitting enter which then navigated us to the pig Latin translator. Using a variable original being equaled to raw_string(“Enter a word”) we created an if statement that verifies the string has characters. Next we added and to our if statement, using .isalpha() to make sure it only contained letters. After this process we were able to start translating to Pig Latin, setting the variable pyg equaled to the suffix ‘ay’. Then adding the lower() function which dies not modify the string but just gives us a lower case version, asking for 0 allowed us t gain the first letter. Needing to add both the letter and the string stored in the variable pyg to the end of the original string, we simply typed the new variable new_word and made it equaled to word + first + pyg. Following we had sliced the string just as the example given in code academy, after we had successfully had fully functional Pig Latin translator.

Leave a Reply

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