← Back to Community
Calculator with actual syntax
Profile icon
ANDREWVOSS

So many people (including me, when I was just getting started) go on replit talk and post "calculators" that look like some variation of this:

enter a number: enter an operator: enter another number:

So, I decided to make a Python script that actually parses mathematical expressions and calculates them. To use it, just type your entire calculation at the input prompt. Everything works as you would expect:
+ for addition
- for subtraction
* for multiplication
/ for division
% for modulo
^ for powers (e.g. 3^2 would be 9)
// or \ for radicals (e.g. 2//4 would be 2)

If you have any feedback, be sure to tell me in the comments!

Voters
Profile icon
lsikora
Profile icon
ANDREWVOSS
Comments
hotnewtop
Profile icon
lsikora

Cool! Its pretty nice that you included powers. That is something unique

Profile icon
ANDREWVOSS

@CodeMaster007 Thanks! This was a challenge for me, so I made sure to make it as good as possible.

Profile icon
lsikora

Yes, it is quite amazing @ANDREWVOSS

Profile icon
ANDREWVOSS

@CodeMaster007 Thanks :)