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]
3 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]3 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
Question #2
Softa [21]

Hofstede's cultural dimensions describe how the world's cultures differ in six main ways and how different cultures should strive to become the same.

<h3>What are the scale of lifestyle and its influences?</h3>

According to Hofstede, the 5 principal dimensions are identity, power, gender, uncertainty, and time. You can reflect on consideration on cultural fee dimensions on a scale or a continuum, in which one element of the fee lies on one aspect of the dimensions and the opposite intense lies at the opposite give up of the dimensions.

  1. To run VBA withinside the “Microsoft Visual Basic for Applications” window, you can surely press the “F5” key button or click on on the “Run” icon withinside the toolbar.
  2. The Visual Basic button opens the Visual Basic Editor, in which you create and edit VBA code.
  3. Another button on the Developer tab in Word and Excel is the Record Macro button, which routinely generates VBA code that may reproduce the actions that you perform withinside the application.

Read more about the Hofstede's cultural dimensions :

brainly.com/question/7158663

#SPJ1

6 0
2 years ago
Read 2 more answers
....................................................................................................
r-ruslan [8.4K]

Answer:

......................

..............

......

....

...

..

.

6 0
2 years ago
What best compares potrait and landscape orientations
REY [17]
In portrait  the height is taller than its wide and in landscape the height is smaller than wide
so its the wider and taller
5 0
3 years ago
Approximately what percentage of the world population owns a smartphone?
Usimov [2.4K]
The number of smartphone users is forcast to grow from 2.1 billion in 2016 to around 2.5 billion in 2019, with smartphone penetration rates increasing as well.over 36% of the worlds population is projected to use a smartphone by 2018, thats up from about 10% in 2011
5 0
3 years ago
About how many jobs in the United States require Microsoft expertise?
GarryVolchara [31]
Answer: C because bill gates is the owner
5 0
3 years ago
Other questions:
  • Pollution or waste that is generated from a business is called a
    6·2 answers
  • Why might your digital footprint be important when you are applying for collage
    13·1 answer
  • A third-grade teacher at Potter Elementary School wants a program that allows a student to enter the amount of money a customer
    14·1 answer
  • 5. How would you describe the relationship between blocks of code and commands?​
    14·2 answers
  • What are some of these new iPad extras? One is the iMarker. Crayola teamed up with another company to make it. It costs $29.99.
    8·1 answer
  • Assume that processor refers to an object that provides a void method named process that takes no arguments. As it happens, the
    7·1 answer
  • Help a brotha out..................
    10·1 answer
  • So I tried asking for help with my code on stackoverflow but the people there were very condescending and mean plus my questions
    7·1 answer
  • Which statements describe the advantages of using XML
    5·1 answer
  • A program that organizes sequences of automated provisioning tasks. A. Application Packager B. Sequence Manager C. Sequence Logg
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!