r/learnpython • • 2d ago

Easy Calculator (Python) :)

I didn't like the Windows Calculator, so I decided to develop my own CMD-based calculator. It's open-source, so anyone is welcome to use it!

https://github.com/PASACore/Calculator_CMD_

0 Upvotes

12 comments sorted by

View all comments

-1

u/Educational_Virus672 2d ago

its nice seeing someone try something like this but im gonna be honest your better off using eval, i see your your problem solving potential but in programming some thigns like this is almost always exist and a programmer should learn to research and adapt keep up the work!

ask = input(">")
try :
    print(eval(ask))
except SyntaxError :
    print("invalid")

5

u/mandradon 2d ago

This is terrible advice. eval should almost never be used due to the ability for command injection into programs.

1

u/SpiderJerusalem42 1d ago

I think for toys you play with on your own computer it's fine, but I wouldn't put it in a GitHub repo.