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
Natalka [10]
2 years ago
10

An acronym is a word formed by taking the first letters of the words in a phrase and making a word from them. For example, AGH i

s an acronym for Alumni Guest House. Write a code snippet that allows a user to type in a phrase, and then outputs the acronym for that phrase. Even if the user doesn't enter the words in all caps, the acronym must be returned with all caps. You may find the methods .split(), .upper() and .lower() helpful, but make sure you test what they do!

Computers and Technology
1 answer:
gregori [183]2 years ago
7 0

Answer:

Here is the Python program:

#the method acronym that takes an argument phrase

def acronym(phrases):  

   acronym = ""  #to store acronym of a phrase

#loop to split the input phrase and return its acronym in upper case letters

   for phrase in phrases.split():  

       acronym = acronym + phrase[0].upper()

   return acronym

#main function that takes input phrase from user and display its acronym

def main():

   phrases = input("Enter a phrase: ")

   print("The acronym for your phrase is ",acronym(phrases))

main()

Explanation:

First let me explain the method acronym. This method takes a parameter phrase to return its corresponding acronym. First the phrase is split using split() method which is used to return the list of words in a phrase. For loop is used that will keep splitting the words in the string (phrase) entered by the user.

In this statement: acronym = acronym + phrase[0].upper()  the acronym is computed. phrase[0] means the first character of each word in the phrase which is found out by the split() method is converted to upper case by using upper() function and then stored in acronym variable. Each time the acronym is found and its first character is converted to upper case and added to the acronym variable.

Then the main() function prompts the user to enter a phrase and then calls the acronym function and passed that phrase as parameter to that function. Then the computed acronym for the phrase is printed on the screen.

You might be interested in
Which of the following CANNOT be done in Normal view A. Enter bolded text in the Notes Pane B. Delete previously entered notes i
blondinia [14]

Answer:

<em>Well, Your answer will be is </em><em>B. Delete previously entered notes in the Notes Pane. Good Luck!</em>

3 0
3 years ago
Hat is the limit of virtual machines that can be connected to a virtual network?
skad [1K]

<u>Unlimited </u> of virtual machines that can be connected to a virtual network.

<h3>What is a virtual machine employed for?</h3>

Virtual machines (VMs) allow a business to run an operating system that conducts like a thoroughly separate computer in an app window on a desktop.

<h3>What is a virtual machine in simple words?</h3>

A virtual machine (VM) is a virtual domain that functions as a virtual computer system with its CPU, memory, network interface, and storage, constructed on a physical hardware system (located off- or on-premises)

To learn more about Virtual machines , refer

brainly.com/question/26771683

#SPJ4

4 0
11 months ago
Select the levels of data backup.
navik [9.2K]
What levels r right and we can pick from??
6 0
3 years ago
Write a program to accept radius and find area of circle
Ilya [14]

Answer:

Change it however you'd like

Explanation:

from math import pi

def findArea(rad):

   return (rad**2) * pi

#test

print(f"Area of the circle: {findArea(5)}")

8 0
2 years ago
Read 2 more answers
How is the number 13,000 abbreviated in scientific notation?
Gennadij [26K]
<span> 13,000 is the same as 1.3 x 10^4</span>
3 0
3 years ago
Read 2 more answers
Other questions:
  • How to access Tor Browser on Android which is not rooted?
    7·1 answer
  • How can a user view the options for Junk E-mail?
    11·2 answers
  • NOTE: in mathematics, division by zero is undefined. So, in C , division by zero is always an error. Given a int variable named
    10·1 answer
  • Linda is the owner of Souvenirstop, a chain of souvenir shops. One of the shops is located at the City Centre Mall. Though the s
    15·1 answer
  • Write a string class. To avoid conflicts with other similarly named classes, we will call our version MyString. This object is d
    5·1 answer
  • ANSWER ASAP!!!!!
    10·2 answers
  • Add Try/Catch error checking To make sure that the user enters valid values in your program. To catch negative values passed to
    9·1 answer
  • Where would you go to access frequently used icons?
    12·2 answers
  • What country is associated with the tor relay using the ip address 104. 244. 74. 97?.
    6·1 answer
  • What is the greatest number of bits you could borrow from the host portion of a class B subnet mask and still have at least 130
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!