110k views
0 votes
6.20 LAB: Acronyms An acronym is a word formed from the initial letters of words in a set phrase. Write a program whose input is a phrase and whose output is an acronym of the input. If a word begins with a lower case letter, don't include that letter in the acronym. Assume there will be at least one upper case letter in the input. Ex: If the input is: Institute of Electrical and Electronics Engineers the output should be: IEEE

2 Answers

3 votes

Final answer:

A program to create acronyms would extract uppercase letters from a phrase to form the acronym. Acronyms, such as HOMES for the Great Lakes, serve as mnemonic devices for easier recall of information.

Step-by-step explanation:

An acronym is a word formed from the initial letters of the words in a phrase, typically using only the capital letters. In computer programming or scripting, you would write a program that reads a phrase and outputs an acronym by identifying the uppercase letters and concatenating them. For example, the acronym for Institute of Electrical and Electronics Engineers is IEEE. Acronyms are not only helpful in everyday language but also in various fields such as science, where Latin names like Escherichia coli are abbreviated to E. coli after the first use.

Creating acronyms can be a helpful mnemonic device for memorization. A famous example is the acronym HOMES to remember the Great Lakes: Huron, Ontario, Michigan, Erie, and Superior. In mathematics, the sentence 'Please Excuse My Dear Aunt Sally' helps recall the order of operations: Parentheses, Exponents, Multiplication, Division, Addition, Subtraction.

User Solix
by
3.7k points
2 votes

Answer:

Step-by-step explanation:

The following code is written in Python. It creates a function that takes in a phrase as an argument. Then it splits the phrase into a list of words. Next, it loops through the list and adds the first letter of each word into the acronym variable if it is a capital letter. Finally, returning the acronym variable. Output can be seen in the attached picture below.

def accronymGenerator(phrase):

phrase_split = phrase.split(' ')

acronym = ""

for x in phrase_split:

if x[0].isupper() == True:

acronym += x[0]

else:

pass

return acronym

6.20 LAB: Acronyms An acronym is a word formed from the initial letters of words in-example-1
User Oscar Mederos
by
4.9k points