Hi guys, in this video I'm going to show you how to make a Calculator using python. so if you like this video, please Subscribe to my channel for more programming-like content.
Code -:
def add(x, y):
return x + y
def subtract(x, y):
return x - y
def multiply(x, y):
return x * y
def divide(x, y):
return x / y
print("Select Oprations")
print("1.add")
print("2.subtract")
print("3.multiply")
print("4.divide")
while True:
choice = input("Enter Choice (1/2/3/4): ")
if choice in ('1','2','3','4'):
n1 = int(input("Enter the first Number:"))
n2 = int(input("Enter the second Number:"))
if choice == "1":
print(n1, '+', n2, '=', add(n1 ,n2))
elif choice == "2":
print(n1, '-', n2, '=', subtract(n1 ,n2))
elif choice == "3":
print(n1, '*', n2, '=', multiply(n1, n2))
elif choice == "4":
print(n1, '/', n2, '=', divide(n1, n2))
break
else:
print("Invaild Number")
Thank You For Watching !
Sur cette page du site, vous pouvez voir la vidéo en ligne How To Make A Calculator | Using Python | Beginner Python Project | durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur ProrammingWith Somesh 31 mai 2021, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 35 fois et il a aimé 6 téléspectateurs. Bon visionnage!