Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

Explain how an embedded audit module works.

Answered: 1 week ago

Question

identify sources of secondary data across organisations;

Answered: 1 week ago

Question

3. The group answers the questions.

Answered: 1 week ago