Design a function that takes one argument

Assignment Help Business Management
Reference no: EM131971719

Please help with the following programming, using python 3:

Pig Latin is a game of alterations played on words. To translate an English word into Pig Latin, 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.

For example,

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

Design a function that takes one argument, a string, and returns a string with each word in the argument translated into Pig Latin.

Hints:

  • The split method, when called with no additional arguments, breaks a string into words, and returns the words in a list.
  • Slicing is your friend: it can pick off the first character for checking, and you can slice off pieces of a string and use string concatenation (the + operator) to make a new word.
  • Making a string of vowels allows use of the in operator: vowels="aeiou" (how do you make this work with both upper and lower case?)
  • Test your function with a diverse range of examples. Your tests should cover all cases (for example, test words beginning with a vowel and words beginning with a consonant). Pay particular attention to edge cases (for example, what happens if the word consists of just one vowel, like "a"? what happens if the string is empty?).

Reference no: EM131971719

Questions Cloud

What is the npv of the acquisition : RiverRocks, whose WACC is 11.5% is considering an acquisition of Raft Adventures (whose WACC is 15.1). What is the NPV of the acquisition?
Useful in illustrating the function : Discuss functions in an organization (e.g., marketing, finance, etc.) that could make the most effective use of each pivot table you located and explain.
Identify key components of the reentry process : What do you think are some strategies in a strength-based approach that a counselor can utilize with a client? Explain how these strategies can be successful.
Create journal entries for purchase of the treasury stock : Create journal entries for the purchase of the treasury stock and the three sales of treasury stock.
Design a function that takes one argument : Design a function that takes one argument, a string, and returns a string with each word in the argument translated into Pig Latin.
Explain the sara problem-solving process : Explain the SARA problem-solving process, its specific stages, and how it is used in law enforcement.
Design a function perfect shuffle : Using python 3, design a function perfect_shuffle(a_list) which takes as argument a list and returns the perfect shuffle of the list.
What steps might you take to be eligible : What steps might you take to be eligible to blow the whistle to the SEC under the Dodd-Frank Financial Reform Act?
Create presentation about the role of scientist-practitioner : Create a 10-12-slide presentation about the role of scientist-practitioners. Include the following in your presentation: At least three scholarly sources

Reviews

Write a Review

Business Management Questions & Answers

  What are parts of developing appropriate hypotheses to test

What are the "tricky" parts of developing appropriate hypotheses to test? What examples can you suggest where this process might be appropriate in your personal or professional lives? (This should be started on Day 1.)

  Determining the common book value

Suppose you buy a stock that paid an annual dividend this year of $5. The firm has Net Income of $1 million and a Common Book Value of $10 million. Also, the firm retains 70% of its net income. Finally, the risk free rate is equal to 4%, the retur..

  Discusses the attitudes towards employee benefits

What do you think employees' general attitudes are towards the benefits packages? Wearing your HR hat, why do you feel this way? How can HR leverage this information to improve benefits packages

  Problem regarding the corporate governance

Consider how hospitals and other health care providers police themselves. Then discuss the concept of corporate governance in health care organizations.

  Basic elements of consideration present

Are the basic elements of consideration present in the neighbor's promise to help John reassemble the garage? Why or why not?

  Sharing of electronic health data

What are some of the privacy concerns you might expect as sharing of electronic health data becomes more common?

  Describe process through objectify phase of enovale process

In this assignment, you will describe the process through the objectify phase of the ENOVALE (E-N-O) Process. Provide your response as a consolidated team response.

  Explain stakeholders and management decisions

Stakeholders and Management Decisions - Expalin How do stakeholders influence management decisions? Can you provide some - along with specific examples to illustrate your explanation?

  Think of a current or previous change

Think of a current or previous change that is occurring/has occurred in one of your organizations. What is personally the most challenging aspect of the change

  Price elasticity of demand for business travelers

An airline estimates that the price elasticity of demand for business travelers (who travel on weekdays) is -2, while the price elasticity of demand for vacation travelers (who travel on weekends) is -5.

  Why is beauty better than intelligence

Persuade your CEO why its important to hire a beautiful person for this position. How will it help the position and the company?

  Determine the primary ways

Analyze the fundamentals of PKI, and determine the primary ways in which its features and functions could benefit your organization and its information security department.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd