HW#3 PYGLATIN

So today’s for HW we’re going to be learning how to create a pig latin translater program , the pig latin translater is defined as a language game where you move the first letter of any word to the end and add “ay” to the end. For example the word I used was Fox, now once we’re done creating the program the word fox should turn to out to be oxfay. So for the first step we create a variable called original and set it to raw_input(“Enter a word:”). This way the python will ask us to enter a word now for the second step we’ll add an “if” and “else” statement. This will make sure that python will print out the word if it has characters if no characters are entered then python wont print it. In addition we add another if statement “original.isalpha()” so that only letters can be entered and not numbers. Now we can’t forget to create a variable for ‘ay’ so will set the variable as pyg. Now we’re going to create a few more if statements , for the next one we’ll create a variable called “word” which will hold the original input word as a lower case.The next variable will be “first” and we’ll set that to “word[0]” so it holds the first letter of the word. Now we start adding strings together so we create a variable called “new_word” and it should be set to word + first +pyg. Now all that’s left is to create one more variable which will be used to slice the second letter of the word all the way to the end of the word. We create this variable by creating another variable called “new_word” and we set that to “new_word[1:len(new_word)]. After all this we should have our translator.