Share your repls and programming experiences

← Back to all posts
Mega Calculator
emilian1000000 (11)

Calculator that calculates a lot of things.

shittyCode (3)

i know im 3 years late, but you could use: numeric_const_pattern = '[+]? (?: (?: \d* . \d+ ) | (?: -?\d+ .? ) )(?: [xyXY(),]? \d+ ) ?'
rx = re.compile(numeric_const_pattern, re.VERBOSE) num = rx.findall(problem)
a, b = num[0], num[1] to find the values as I've found that simply throwing an accidental letter in there breaks the whole program. You could also modify numeric_const_pattern so it could be used to find numbers for the average. Finally, I wanted to add that you could use a switch statement instead of elifs for detecting the function. PS, you need to import re to use re.findall/rx.findall

shittyCode (3)

@shittyCode BTW you need to import re to use re.findall/rx.findall

ay14 (2)

Good and polite calculator. Heres an upvote

proofofconcept (22)

Why do you import statistics if it is never used?

emilian1000000 (11)

@proofofconcept: Hmmm, I haven't seen that. I wonder why it's there...