# Demo entry 6691689

Calculator

Submitted by David Feng on Jan 12, 2018 at 22:13
Language: Python 3. Code size: 2.3 kB.

```import math

#texts to display
print("┌----------------------------------------------------------┐")
print("| Welcome to Text-based Calculator version 3.0 by David Feng |")
print("└----------------------------------------------------------┘")
print("")
print("Functions:")
print("[+] number1 plus number2")
print("[-] number1 subtract number2")
print("[*] number1 multiply number2")
print("[/] number1 divide number2")
print("[^] number1 to the power of number2")
print("[sin] the sine of number")
print("[cos] the cosine of number")
print("[tan] the tangent of number")
print("[m] change memory number")
print("")

while(1 == 1):
if(func == "m"):
mem = float(input("Please enter new value of m."))
print("Memory number changed to", mem)
elif((func == "sin") or (func == "cos") or (func == "tan")):
num1str = str(input("Please enter the number."))
if(num1str == "m"):
num1 = mem
else:
num1 = float(num1str)
else:
num1str = str(input("Please enter the first number."))
num2str = str(input("Please enter the second number."))
if(num1str == "m"):
num1 = mem
else:
num1 = float(num1str)
if(num2str == "m"):
num2 = mem
else:
num2 = float(num2str)

#calculation process
if(func == "+"):
mem = (num1 + num2)
elif(func == "-"):
mem = (num1 - num2)
elif(func == "*"):
mem = (num1 * num2)
elif(func == "/"):
mem = (num1 / num2)
elif(func == "^"):
mem = (num1 ** num2)
elif(func == "sin"):