Skip to content
Sign upLog in
← Back to Community

Mega Calculator

Profile icon
emilian1000000

Calculator that calculates a lot of things. https://repl.it/@emilian1000000/Mega-Calculator

Voters
Profile icon
EshaanAhuja
Profile icon
shittyCode
Profile icon
ay14
Profile icon
muhayyo
Profile icon
mcilie
Profile icon
emilian1000000
Comments
hotnewtop
Profile icon
shittyCode

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

Profile icon
shittyCode

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

Profile icon
ay14

Good and polite calculator. Heres an upvote

Profile icon
proofofconcept

Why do you import statistics if it is never used?

Profile icon
emilian1000000

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