Question: python program Write a problem that does the following: Prompt for a phrase & read it in. Make the phrase upper case. Split up the

python program

Write a problem that does the following:

  1. Prompt for a phrase & read it in.
  2. Make the phrase upper case.
  3. Split up the phrase into words.
  4. Take the first letter of each word (keep in mind that split() returns a list of the words ) and concatenate from last to first to make a backwards acronym of it

A sample run of your program should look like:

 Enter a phrase: City University New York Your phrase in capital letters: CITY UNIVERSITY NEW YORK Acronym: YNUC 

Another run:

 Enter a phrase: Hunter College Your phrase in capital letters: HUNTER COLLEGE Acronym: CH

the code which i tried is

print('Enter a phrase') #asking the user for a input 
 
Strup=input() #storing the input in Strup variable 
 
Strup1=Strup.upper() #CONVERTING THE PHRASE INTO UPPER CASE 
 
print('your phrase in capital letters:' + Strup1) #DISPLAYING 
 
#USING THE VARIABLE acro TO STORE ACRONYM 
 
acro="" for i in Strup1.split(): 
 acro=acro+i[0] #STRORING THE FIRST VALUE OF THE STRING STORD IN i 
#displaying the acronym 
print('Acronym: '+acro) 

the answer i got is

Program printed: Enter a phrase your phrase in capital letters:CITY UNIVERSITY NEW YORK Acronym: CUNY Expected output: Your phrase in capital letters: CITY UNIVERSITY NEW YORK Acronym: YNUC Test Failed: False != True

Simple test: achronym of Hunter College (0.0/2.0)

Your program printed: Enter a phrase your phrase in capital letters:COLLEGE STATEN ISLAND Acronym: CSI Expected output: Your phrase in capital letters: COLLEGE STATEN ISLAND Acronym: ISC Test Failed: False != True

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!