Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Calculator-I by kazuki.h
def calculator(log):
memory, display = "0+", "0"
for i in log:
if i.isdigit():
if display != "0": display += i
else: display = i
else:
memory += display if i == "=" else display+i
display = ""
return display if display else str(eval(memory+"+0"))
Feb. 12, 2023
Comments: