Calculator in Python
https://replit.com/@LukmanA47/Calculator-published-on-06122021-at-1002pm#main.py
#menu
def menu():
print("[1] Addition")
print("[2] Multiplication")
print("[3] Subtraction")
print("[4] Divison")
print("[5] End")
option = int(input("Enter your Option: "))
if option == 1:
addition()
elif option == 2:
multiplication()
elif option == 3:
subtraction()
elif option == 4:
divison()
elif option == 5:
finish()
if option > 5:
print("You typed the wrong number")
print()
menu()
#ending the programm
def finish():
quit
print("Ended")
print("Created by Lukman on 06/12/2021 at 9.50PM")
def addition():
num1 = int(input("First Number: "))
num2 = int(input("Second Number: "))
print("Answer is: ",num1 + num2)
def multiplication():
num1 = int(input("First Number: "))
num2 = int(input("Second Number: "))
print("Answer is: ",num1 * num2)
print()
menu()
def subtraction():
num1 = int(input("First Number: "))
num2 = int(input("Second Number: "))
print("Answer is: ",num1 - num2)
print()
menu()
def divison():
num1 = float(input("First Number: "))
num2 = float(input("Second Number: "))
print("Answer is: ", num1 / num2 )
print()
menu()
#menu init
menu()
#thanks to parth Amreliya
Comments
Post a Comment