0
I'm about to make a complex calculator in python
5 ответов
+ 3
Asmaa Abdelsattar ,
do you need any help from the community?
+ 1
using eval() in python is generally discouraged unless there is no other possible way.
eval() executes strings as python code. if any part of the string is user-controlled like inputs, it opens the door to code injection attacks.
see comments in this post of stackoverflow:
https://stackoverflow.com/questions/1832940/why-is-using-eval-a-bad-practice
years ago, we have had discussions about using eval() frequently.
0
Just write
print(eval(input()))
And your’e done!
Thanks parrot for the tip!
0
Lothar seriously it was a dumb comment on a dumb post.
No need to always be so serious.
0
Zvi ,
it is not a dump question / post, and potential security risks must be taken seriously.