0
Can you use eval as a calculator in python?
I know that eval covers all the basic operations, my only problem is that users may not know how to use it, resulting in many syntax errors. Also, you can input really any python function into eval(), so what I’m wondering is, is eval() a viable solution for calculator programs?
2 Respostas
+ 5
No, using eval() for a calculator isn't a good idea. Take a look at the program which uses eval() to perform a task of a calculator. Look for a comment from Mirielle
https://code.sololearn.com/clGB3RIP20to/?ref=app
Calculator programs:
https://code.sololearn.com/c1xFnov4LlEP/?ref=app
https://code.sololearn.com/chZ1vV0x3V0G/?ref=app
+ 2
Thx lamron!