Share your repls and programming experiences

← Back to all posts
Calculator with actual syntax

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!

CodeMaster007 (108)

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


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