1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Sliva [168]
3 years ago
8

Write a function getPigLatin(pigStr) that accepts pigStr as a parameter (a sentence as input) and converts each word to "Pig Lat

in." and returns the entire string in Pig Latin. In one version, to convert a word to Pig Latin, you remove the first letter and place that letter at the end of the word. Then, you append the string "ay" to the word. Here is an example:
English: I SLEPT MOST OF THE NIGHT


Pig Latin: IAY LEPTSAY OSTMAY FOAY HETAY IGHTNAY
Computers and Technology
1 answer:
Vladimir79 [104]3 years ago
8 0

Answer:

userInput = str(input("Enter your sentence here.\n")).upper()

def getPigLatin(userInput):

   splitInput = userInput.split(" ")

   newList = []

   for word in splitInput:

       firstLetter = word[0]

       if len(word) == 1:

           word += 'AY'

           newList.append(word)

       else:

           word = word.strip(word[0])

           word += firstLetter

           word += 'AY'

           newList.append(word)

   print(*newList, sep= " ")

getPigLatin(userInput)

Explanation:

This solution is done in Python

First the user is prompt to enter a statement, the statement converted to string and also capitalize using str and upper() built-in function. The user input is assigned to userInput variable.

The getPigLatin function is defined and it accept a string as parameter. Inside the getPigLatin function, the userInput is splitted and assigned to splitInput variable.

An empty list is also initialized and assigned to newList. Next, we loop through the splitInput. During the loop; we first check if the length of an element is one, then we just add 'AY' to the element and add the element to the newList. Else, if the element length is more than one; we strip the first letter from the word and also re-assign it to word, then the stripped first letter is added to the end of the word. Next, 'AY' is added to the word and the element is add to the newList.

The last line of the getPigLatin function display the entire element of the list using a space seperator.

The last line of the entire solution call the function passing in the userInput as argument.

You might be interested in
When you're working with a word processing document and you press the Del key, what happens? A. The paragraph you're working on
Bezzdna [24]
Option c. The entire document is deleted




4 0
2 years ago
HELP PLEASE
Mashcka [7]

A typical example of a Soft skills based question will be "tell us about your interpersonal skills" and "tell us about your time management".

<h3>What are Soft skills?</h3>

Soft skills refers to skills and traits that help employees interact with others and succeed in a typical workplace.

Some example of Soft skills include:

  • interpersonal skills
  • communication skills
  • listening skills
  • time management
  • empathy skills etc

Hence, an example of a Soft skills based question will be "tell us about your interpersonal skills" and "tell us about your time management".

Read more about Soft skills

<em>brainly.com/question/8381292</em>

3 0
1 year ago
What is machine learning
Katyanochek1 [597]

Answer:

machine learning is the ability for computers to develop new skills and algorithms without specific instructions to do so.

5 0
2 years ago
Read 2 more answers
Write an application that allows a user to enter the names and birth dates of up to 10 friends. Continue to prompt the user for
mylen [45]
Sorry I don’t know the answer I am really sorry
5 0
3 years ago
What underlying concept is edge computing based on?
guajiro [1.7K]

Answer:

Edge computing was developed due to the exponential growth of IoT devices, which connect to the internet for either receiving information from the cloud or delivering data back to the cloud. And many IoT devices generate enormous amounts of data during the course of their operations.

Explanation:

8 0
2 years ago
Read 2 more answers
Other questions:
  • While working on a group project, you notice something does not look right in the presentation. You call a meeting with your tea
    14·2 answers
  • Why might your digital footprint be important when you are applying for collage
    13·1 answer
  • The __________ method can determine whether a string contains a value that can be converted to a specific data type before it is
    12·1 answer
  • Explain the functions of a VDU?
    6·1 answer
  • 27. If X and Y are int type variables,
    14·1 answer
  • Why should running your unit test suites not take a long time?A. Unit tests aren't that important, so less time should be spent
    5·1 answer
  • With SQL, how do you select all the columns from a table named "Persons"?
    8·1 answer
  • Rosanna is a middle school teacher. She has installed a spreadsheet program in her computer that tracks the grades and attendanc
    10·1 answer
  • what is the importance of familiarizing and understanding the cells rows and format tools in the microsoft cell​
    9·1 answer
  • 9
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!