how to make advanced calculator in python with simple gui interface in Terminal
logo = """
_____________________
| _________________ |
| | Calulator | |
| |_________________| |
| ___ ___ ___ ___ |
| | 7 | 8 | 9 | | + | |
| |___|___|___| |___| |
| | 4 | 5 | 6 | | - | |
| |___|___|___| |___| |
| | 1 | 2 | 3 | | x | |
| |___|___|___| |___| |
| | . | 0 | = | | / | |
| |___|___|___| |___| |
|_____________________|
"""
while True:
print(logo)
def addition(Num1,Num2):
return Num1 + Num2
def Subtract(Num1,Num2):
return Num1 - Num2
def Multiply(Num1, Num2):
return(Num1 * Num2)
def divide(Num1,Num2):
return Num1 / Num2
Num1_value = int(input("Number 1:- "))
Opration = str(input("Which opration do you want to do +, -, *, /:- "))
Num2_value = int(input("Number 2:- "))
if Opration == "+":
ans = str(addition(Num1_value,Num2_value))
elif Opration == "-":
ans = str(Subtract(Num1_value,Num2_value))
elif Opration == "*":
ans = str(Multiply(Num1_value,Num2_value))
elif Opration == "/":
ans = str(divide(Num1_value,Num2_value))
else:
print("Input is incorrect")
ans2 = ans
logo2 = """
_____________________
| _________________ |
| | """+ans2+"""
| |_________________| |
| ___ ___ ___ ___ |
| | 7 | 8 | 9 | | + | |
| |___|___|___| |___| |
| | 4 | 5 | 6 | | - | |
| |___|___|___| |___| |
| | 1 | 2 | 3 | | x | |
| |___|___|___| |___| |
| | . | 0 | = | | / | |
| |___|___|___| |___| |
|_____________________|
"""
print(logo2)
continue_or_not = str(input("Do You Want to Continue 'Yes' or 'No':- ")).lower()
if continue_or_not == "yes":
continue
elif continue_or_not == "no":
break
else:
print("Try again")