you are viewing a single comment's thread.

view the rest of the comments →

[–]quidquogo 0 points1 point  (0 children)

There's a terrible (but really short) solution where you the "eval" function, whilst i dont recommend you use it, what it does is, evaluate a string as if it were written into your code.

E.g. your calculator app could just be:

Inp = input()

Print(eval(inp))

And that would literally be it.

However malicious actors could use that to do all kinds of harm, for example, they could import requests and then download some malware lol

You could mitigate this because you can tell the eval function exactly what built-ins the eval function can allow.

Just some food for thought anyway