Lab 4: PigLatin


In this lab of Lab 4: Piglatin we introduce lots of things in this new unit. We introduce vowels, new fuctions and extending the if and else functions as seen in the last unit of conditionals in python but in this unit of piglatin it goes more in depth with the concept of latin and english. Except that now we are using how to use these words by putting them into else and if statements as you will see below in the following code that i will be explaining to you in the next section of this lab. As you see moving more onto python program changes its begining input now for this section you will notice we start from scratch with the “welcome…” then we just introduce the pyg = ‘ay’ you will notice in this lab.



In this lab which is Lab 4: Pig latin we introduce the piglatin language or part for python… In this section of python we have to write a code that introduces phrases and after that we have to use vowels and also consonants and by saying that we have to input a specific coding of various vowels to a whole string so that in the end where we introduce the new word that vowel string has to interpret the output of what word we will type. SO, we introduce pyg = ‘ay’ as the new input command for piglatin section only for this section we use pyg = ‘ay’. next we have to input original equal to another input which that parenthesis says enter a word, towards the end that phrase will be extremely vital to pass this section. After that we need to use a if string input using LEN again as you original is inputted there and its doing a greater than 0 to original.isalpha(): this following has to be in this so we know that there is a word or vowel we are wanting to enter. Next we write variable word equals to the function so this word can be all lower case after that we type the new word function equal to pyg now this means we really will have a new word. Then we introduce another variable first equal to word in function 0. After this its when i said about the whole string to input all vowels thats needed this is really important this part. After that we print new word and after we equal the new word to the changed word + the first function and png too. After that we finally click submit and we finish with the lab.

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 == "u" or first == "o" or first == "i":
        new_word = word + pyg
        print new_word
        changed_word = word[1:]
        new_word = changed_word + first + pyg
        print new_word
    print 'empty'



This is the screenshot of this lab which is lab 4 pig latin and as you see below you can see that i got my screenshot based on of course codeacademy and by finishing the final part of piglatin i click submit and after i printscreen on this tab then after that i went on paint to paste the print screen i had executed before and after that its when i save it and save it as a PNG file because here the only image type accepted is PNG nothing else after that i just paste it to this lab report. The final result of this lab as you can see is below and thats the conclusion of this lab (Lab 4: Piglatin)

Untitled   5444

Leave a Reply

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