How To Make A Calculator | Using Python | Beginner Python Project |

Published: 31 May 2021
on channel: ProrammingWith Somesh
35
6

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 !


On this page of the site you can watch the video online How To Make A Calculator | Using Python | Beginner Python Project | with a duration of hours minute second in good quality, which was uploaded by the user ProrammingWith Somesh 31 May 2021, share the link with friends and acquaintances, this video has already been watched 35 times on youtube and it was liked by 6 viewers. Enjoy your viewing!