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
I need help now I really do what is the answer thank you
Svetradugi [14.3K]
The answer is c
just replace the y with the y value and the x with the x value
4 0
3 years ago
How to use github to creat a blog?Thank you
stepan [7]
You can use GitHub Pages! They have tutorials on their site to help you set up using that (too much for this format!). You can use it to make your own personal site, as well as host any existing site you may have.
5 0
3 years ago
You can run a macro by:
oee [108]

Selecting the button assigned

Using the shortcut Keys assigned

Explanation:

By clicking the assigned button one can run a macro and we can assign a short cut key to macro which we created.

So, the two options we can use to run a macro.

7 0
3 years ago
What type of lens was used to take this picture?
Leona [35]

Fish-eye because this is how you would see through a "fish eye" point of view in a rounded tank that is commonly used.

May I please have brainliest

4 0
3 years ago
How to calculate 100MB at 56 Kbps to transfer time?
Gelneren [198K]
1MB=1000 kb 

\frac{100*1000Kb}{56Kb/s} ≈ 1748,71 seconds 


ransform in kilobyte and share knowing transfer time :)
3 0
3 years ago
Other questions:
  • What common communication devices are used in homes to connect to the internet and remote networks and what capabilities do thes
    10·1 answer
  • Naruto Uzumaki who likes naruto ??? who waches it??
    14·2 answers
  • What is the purpose of the domain name​
    5·1 answer
  • How can officers in the armed services receive college educations? Select the best answer choice. A. All of the answers are corr
    11·1 answer
  • How do you customize Track Changes in a text document?
    11·1 answer
  • what version of the internet do we use as an interactive social system in which users are able to interact with senders
    7·1 answer
  • Tom and his brother caught 100 finish on a weeklong fishing trip. The total way of the fish was 235 pounds. What is the weight o
    9·1 answer
  • Explain how you can apply the computer in your field of study​
    6·1 answer
  • (a) Write a program which calculates and displays the obtained marks, percentage in six subjects and assigns grades based on per
    6·1 answer
  • Which type of computer is used to process large amount of data​
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!