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 !
Nesta página do site você pode assistir ao vídeo on-line How To Make A Calculator | Using Python | Beginner Python Project | duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário ProrammingWith Somesh 31 Maio 2021, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 35 vezes e gostou 6 espectadores. Boa visualização!