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

Respuesta :

Answer:

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

Ver imagen sandlee09
ACCESS MORE
EDU ACCESS
Universidad de Mexico