Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hey, this should be easy but in my attempts I can only get all of the hidden tests (different words) to return one case yay
Hey, this should be easy but in my attempts I can only get all of the hidden tests (different words) to return one case "yay" or "ay" ie my code is not working.
What would be the python code for this?
Write a function called pig_latinify (word) that takes a word string and returns the Pig Latin version of the word. For simplicity all test cases will only contain lowercase characters and digits. To convert an English word to Pig Latin word you will need to use the following rules: If the word starts with a consonant then the Pig Latin version is formed by moving the first letter to the end of the word and adding the string "ay", for example, turtle > urtletay If the word starts with a nonconsonant character then the Pig Latin version is simply the English word followed by "yay", for example, egg > eggyay and 121 word > 121wordyay To keep things simple, consonants are defined as "bcdfghjklmnpqrstvwxyz". As outlined in the second rule above, all numerical digits and punctuation characters should be effectively treated as nonconsonants (eg,, : 4, and 7 are not consonants). For example: Test Result pig_latin_word= pig_latinify("turtle") urtletay print (pig_latin_word)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started