DEV Community

Cho yi Law
Cho yi Law

Posted on

Why is my acronym generator wrong ? I don’t understand…

Image description

Top comments (4)

Collapse
 
pandademic profile image
Pandademic

You haven't defined a. In your code you have defined acronym , but not a. You probably meant to type acronym , but messed up
To fix it:
change the print on the last line , and replace the a with acronym

Anyway , good luck!

Collapse
 
joey_lcy_071 profile image
Cho yi Law

thank you !!!! You saved my life cuz this one is actually my homework TwT

Collapse
 
damjand profile image
Damjan Dimitrov

You've used the expression

"print(f'Acronym of {user_input} is {a}')"

Where 'user_input' and 'a' are variables. In your current scope, user_input is a variable, however 'a' is not, so you get an error saying "name 'a' is not defined".

You should change {a} to {acronym} and it's going to work.

Collapse
 
joey_lcy_071 profile image
Cho yi Law

Thank you for your helpppp ! I will revise it. Finally I can submit my Homework TwT