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

Publicado el: 31 mayo 2021
en el canal de: 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 !


En esta página del sitio puede ver el video en línea How To Make A Calculator | Using Python | Beginner Python Project | de Duración hora minuto segunda en buena calidad , que subió el usuario ProrammingWith Somesh 31 mayo 2021, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 35 veces y le gustó 6 a los espectadores. Disfruta viendo!