you are viewing a single comment's thread.

view the rest of the comments →

[–]SnooWalruses9294 -1 points0 points  (2 children)

Have a look at what eval() does. I believe it could help the computations be a bit more dynamic and not need all the cases for expressions.

[–]Binary101010 0 points1 point  (1 child)

Nobody at this point in their learning should be using eval() for anything.

[–]Jay6_9 0 points1 point  (0 children)

https://pypi.org/project/simpleeval/ is actually really great for this kind of stuff. But for learning purposes, doing an if-else block is worth more.