Please please help me fix this | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please please help me fix this

How do I fix this. Please share https://sololearn.com/compiler-playground/ck2z0NI1Rdg8/?ref=app

24th Jan 2024, 10:26 AM
Theo
Theo - avatar
6 Answers
+ 5
Use print (locals()[namething]) instead of print(namething)
24th Jan 2024, 11:02 AM
SoloProg
SoloProg - avatar
+ 5
Theo , an other way of doing this task could be to take all the text / strings out of the code and put them in a file (csv file). from there we can read it and store it in a dictionary. so searching and mapping will get convenient. i have reactivated a code that i have done some months ago in pydroid and have put it in the attached file. it does not give you a ready-made code, but you can find everything in there what is required to get your project run in the mentioned way. https://sololearn.com/compiler-playground/cpFjQ1gb79Ho/?ref=app
25th Jan 2024, 8:21 PM
Lothar
Lothar - avatar
+ 1
Theo , You fixed it already, but here is an alterative fix to ponder as well. print(eval(namething))
24th Jan 2024, 8:14 PM
Rain
Rain - avatar
0
What is the issue here and what you want to do.
24th Jan 2024, 10:34 AM
A͢J
A͢J - avatar
0
The program is working perfectly. It asks user for input and print it out. What you want to fix?
24th Jan 2024, 10:34 AM
Wong Hei Ming
Wong Hei Ming - avatar
24th Jan 2024, 10:46 AM
Faisal Rahman
Faisal Rahman - avatar