Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Business Management Expert

For Intro to Python Class.

Pig Latin is a language game in which words are altered according to certain rules. 

To make the pig latin form of an English word, the initial consonant sound is transposed to the end of the word, and an "ay" is affixed. Specifically, there are two rules: 

  • If a word begins with a vowel, append "yay" to the end of the word. 
  • If a word begins with a consonant, remove all the consonants from the beginning up to the first vowel and append them to the end of the word. Finally, append "ay" to the end of the word. The letter "y" counts as a consonant. If there are no vowels, simply append "ay" to the end of the word. 

For example: 

  • dog => ogday
  • python => onpythay
  • scratch => atchscray
  • is => isyay
  • apple => appleyay

(a) In the file problem1.py, write a function

def piggify(word):...

that takes an input String word as its parameter and returns a string containing the pig latin translation of the word. You can assume that the input is always a lower-case string (no input verification is necessary). 

Hints: Use indexing and slicing. You might also want to use a string of vowels and then use the in operator to check if a letter is a vowel.

vowels = 'aeiou'

(b) In the same file, write a program that repeatedly prompts the user to input a new word and then prints the pig latin translation of the word (by calling the piggify function). When the user types a single period, the program should quit.

Business Management, Management Studies

  • Category:- Business Management
  • Reference No.:- M92484486
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Business Management

Generate a c program tonbspsort items of a structs-of-array

Generate a C++ program to sort items of a structs-of-array. Assume that the struct is  struct invoice  { unsigned int custNo; unsigned short amount; string owner; }; Generate an array with 20 invoices, which are randomly ...

What is the benefit the beyond budgeting please also

What is the benefit the Beyond budgeting? Please also explain how each are used.

Explain the equity theory adams why would an administrative

Explain the Equity theory (Adams). Why would an administrative worker be better motivated by the Equity theory?

Part 1whats the importance of a documentation plan please

Part 1: What's the importance of a Documentation Plan? Please provide an example of a Documentation Plan that you would use. Part 2: How do you calculate how long a project will take? These questions are for my Introduct ...

With current technology suppose a firm is producing 500

With current technology, suppose a firm is producing 500 shirts daily. Also assume that the least-cost combination of resources in producing those shirts is 10 units of labor, 8 units of land, 3 units of capital, and 4 u ...

Evaluate the processes that are involved in a systems

Evaluate the processes that are involved in a systems development lifecycle (SDLC) and how the processes relate to each other.

1 many employees are unwilling to relocate because they

1) Many employees are unwilling to relocate because they like their current community, and their spouses and children prefer not to move. Yet employees need to develop new skills, strengthen skill weaknesses, and be expo ...

What is the basic premise of abraham maslows hierarchy of

What is the basic premise of Abraham Maslow's hierarchy of needs theory and what levels comprise the hierarchy?

Compare and contrast replacement charts and succession

Compare and contrast replacement charts and succession planning?

Johanna likes to drink her coffee with milk and never black

Johanna likes to drink her coffee with milk (and never black!). She requires 3 tbsp of milk to be able to enjoy one cup of coffee. Suppose that Johanna has $22 to spend on coffee and milk per week. Coffee costs $1.25 per ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As