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]
4 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]4 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
The final step in the object-oriented design (ood) process consists of developing the?
kenny6666 [7]

The final step in the object-oriented design (OOD) process consists of developing the <u>package diagrams.</u>

<u></u>

In the field of Computer studies, object-oriented design (OOD) can be described as a design method in which a proper system of interacting objects is planned for making a computing system or software.

The final step of an object-oriented design (OOD) involves the development of package diagrams. Package diagrams are structures or diagrams that are used for representing the model elements. The model elements are shown as packages in this kind of diagram.

Package diagrams are the final step of an object-oriented design process because they help to provide a visual idea of the overall proposed design.

To learn more about object-oriented designs, click here:

brainly.com/question/13383471

#SPJ4

5 0
2 years ago
The inability of BAE Automated Systems to create an automated baggage handling system led to a significant delay in the opening
Sergeu [11.5K]

Answer:

True

Explanation:

Airport was truly opened outside the city of Denver, because of the faults in BAE automated system.

6 0
3 years ago
Some architectures support the ‘memory indirect’ addressing mode. Below is an example. In this case, the register R2contains a p
egoroff_w [7]

Answer:

Following is given the solution to question I hope it will  make the concept easier!

Explanation:

7 0
3 years ago
What is the name given to software that decodes information from a digital file so that a media player can display the file? har
KiRa [710]

Answer:

plug-in

Explanation:

A Plug-in is a software that provides additional functionalities to existing programs. The need for them stems from the fact that users might want additional features or functions that were not available in the original program. Digital audio, video, and web browsers use plug-ins to update the already existing programs or to display audio/video through a media file. Plug-ins save the users of the stress of having to wait till a new product with the functionality that they want is produced.

6 0
3 years ago
When you send an email how many computers does it go to
Xelga [282]

once you have sent the email it will only go to the server which then the person receiving it would log on therefore requesting the emails recived.

I'm not 100% sure my answer is classed as correct but I would say it doesn't go to a computer it just gets stored on a server in till requested

4 0
3 years ago
Other questions:
  • A disadvantage of creating a website with tables, without CSS is
    15·2 answers
  • A ____ is a theoretical model of computation that includes a (conceptual) tape extending infinitely in both directions.
    13·1 answer
  • Question 4 of 20
    5·1 answer
  • Explain why a document created by word processing software is stored as a binary file.​
    14·1 answer
  • Write a program that allows the user to enter a time in seconds and then outputs how far an object would drop if it is in free f
    7·1 answer
  • Your assignment is to write an assembly language program which read a string and print it in uppercase. This program asks the us
    11·1 answer
  • Elsa wants to save her work at the office to be continued at home either on a pen drive or CD. Outline three reasons why she wil
    6·1 answer
  • Larry does not want to save his internet browsing details on his computer. What files should Larry delete to clear his informati
    13·2 answers
  • Explain the history of computing device of mechanical era
    7·1 answer
  • Consider the following correct implementation of the selection sort algorithm.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!