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
Pls answer i will give 20 points
Misha Larkins [42]

Answer:

Penicilium roqueforti

4 0
2 years ago
What is the difference between - and % in mysql
jarptica [38.1K]

Answer:

Explanation:

Mysql is an open source database management system written in C and C++ language used to store, retrieve or modify a database. Mysql is used as a web database. Mysql can be combined with other programs so as to provide relational database capabilities as well as its implementation.

% matches any number of characters as well as zero characters while _ matches exactly one character.

3 0
3 years ago
Variables make it easier to do what?
defon
<span>D. Make changes to your code
Variables allow the ability to easily substitute numbers for other numbers.
</span>
8 0
3 years ago
Michael works for a graphic design firm. He is creating an informative poster. He needs to add a great deal of text in the poste
Dennis_Churaev [7]

Michael will use a Adobe Photoshop or CorelDraw   tool to help format the text for creating an informative poster.

<h3>What application is used for graphic design?</h3>

They are:

  • Adobe Photoshop
  • Illustrator, GIMP
  • CorelDraw
  • Canva  and others

Based on the American Institute of Graphic Arts (AIGA), graphic design is known to be a term that is described as “the art and method of planning and bringing forth ideas and experiences along with the use of visual and textual content.”

Therefore, Michael will use a Adobe Photoshop or CorelDraw   tool to help format the text for creating an informative poster.

Learn more about graphic design from

brainly.com/question/27019704

#SPJ1

3 0
2 years ago
Which law requires employers to provide safe working environments for their employees? A. Civil Rights Act B. Fair Labor Standar
xeze [42]

the answer is c, occupational safety and health act

7 0
3 years ago
Other questions:
  • A __________ is the column of data in a database that is used as the basis for arranging data.
    8·2 answers
  • 2. What is the layout of the modern keyboard known as?
    13·1 answer
  • ____ is another term for document properties.
    12·1 answer
  • __________ offers a mechanism to accomplish four security goals: confidentiality, integrity, authentication, and nonrepudiation.
    9·1 answer
  • Tweaking existing technology in a new way is usually called _____. leveraged creativity state-of-the-art breakthrough applicatio
    5·1 answer
  • Which word goes with "meals
    5·2 answers
  • NoSQL is a programming language used to create mobile apps.<br> a) True<br> b) False
    13·2 answers
  • Which of the following would most likely be the target audience for a product
    7·2 answers
  • Old systems can be useful when designing new computer software.<br> True or False
    7·2 answers
  • Fre.e points enjoy em
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!