Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Problem Pig Latin is a game that children often play. It is a way of encoding a word that can be described by two

Python Problem

Pig Latin is a game that children often play. It is a way of encoding a word that can be described by two simple rules:

If the word begins with a vowel ('a', 'e', 'i', 'o' or 'u'), add 'yay' to the end of the word.

If the word begins with a consonant (the other letters), take all the consonants before the first vowel, add them to the end of the word, and then add 'ay' to the end of the word.

Write a function that takes a word n and returns its Pig Latin equivalent.

For example:

If n = 'aArdvArk', pig_latinify(n) should return 'aArdvArkyay'.

If n = 'wombat', pig_latinify(n) should return 'ombatway'.

If n = 'Thylacine', pig_latinify(n) should return 'acineThylay'.

n is a non-empty string and contains at least 1 vowel,r function should return a value of type str and work for letters in both upper and lower case (and a mixture).

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

Successful Keyword Searching Initiating Research On Popular Topics Using Electronic Databases

Authors: Randall MacDonald, Susan MacDonald

1st Edition

0313306761, 978-0313306761

More Books

Students also viewed these Databases questions