Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

def main() : phrase = input(Give the phrase: ) words = phrase.split() # get the words in a list # generate the acronym string acro

def main() :

phrase = input("Give the phrase: ")

words = phrase.split() # get the words in a list

# generate the acronym string

acro = "" # intialize

for w in words: # loop through the list of words

acro += w[0] # add first character

acro = acro.upper() # capitalize

print(acro)

Make a function out of above program that takes a phrase as a parameter and returns its acronym. Then write a program that asks the user for an input file name and an output file name. The program should then open the input file, treat whatever is on each line as a phrase and make its acronym using the function. It should print the acronyms, one per line to the output file. Assume that the input file will be already present in your default Python folder. The output file will be expected to get saved to the same folder.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions

Question

c. What did the listeners observe about the speakers?

Answered: 1 week ago

Question

3. What may be the goal of the team?

Answered: 1 week ago