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

Pubblicato il: 31 maggio 2021
sul canale di: 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 !


In questa pagina del sito puoi guardare il video online How To Make A Calculator | Using Python | Beginner Python Project | della durata di ore minuti seconda in buona qualità , che l'utente ha caricato ProrammingWith Somesh 31 maggio 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 35 volte e gli è piaciuto 6 spettatori. Buona visione!