0

I'm about to make a complex calculator in python

6th Aug 2025, 12:08 PM
Asmaa Abdelsattar
Asmaa Abdelsattar - avatar
5 Antworten
+ 3
Asmaa Abdelsattar , do you need any help from the community?
6th Aug 2025, 2:05 PM
Lothar
Lothar - avatar
+ 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.
6th Aug 2025, 7:02 PM
Lothar
Lothar - avatar
0
Just write print(eval(input())) And your’e done! Thanks parrot for the tip!
6th Aug 2025, 2:35 PM
Zvi
Zvi - avatar
0
Lothar seriously it was a dumb comment on a dumb post. No need to always be so serious.
6th Aug 2025, 7:08 PM
Zvi
Zvi - avatar
0
Zvi , it is not a dump question / post, and potential security risks must be taken seriously.
6th Aug 2025, 7:28 PM
Lothar
Lothar - avatar