+ 1
I'm about to make a complex calculator in python
11 Risposte
+ 3
Asmaa Abdelsattar ,
do you need any help from the community?
+ 3
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.
+ 3
Zvi ,
it is not a dump question / post, and potential security risks must be taken seriously.
+ 3
Zvi
it's like handing a loaded gun to a kid who don't know any better.
I agree, it's a clueless, cryptic question. I also see a lot of similar posts lately and it's depressing.
But passing footguns to everyone so they can go shoot themselves is not the way to solve it.... 😅
+ 3
Phantom Matryx ,
any information (including personal information like phone numbers, email addresses) you share in our community is, by design, open to the public and not private. think carefully before sharing any personally identifiable information in any public place.
+ 2
Rofl!🤣🤣
Can’t wait to see all the security implementations that will be used.
Maybe parrot will make a parody of an overengineered calculator complete with salting and encryption!
+ 1
Just to be sure, as this is a written forum so sometimes these things aren’t obvious, I am saying this all in good humor not flaming or trying be rude.
Peace out bro!
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
Bro
0
Just write
Calculator = eval(input("enter the equation"))
Print(Calculator)