Mini Calculator for beginners

 #First project for Beginners 

#code of python programming language


def add(a,b):
result=a+b
print(result)

def sub(a,b):
result=a-b
print(result)

def mul(a,b):
result=a*b
print(result)

def div(a,b):
result=a/b
print(result)

a=int(input("Enter the First number:"))


op=input("Enter the operation:")

b=int(input("Enter the Second number:"))

if op=="+":
add(a,b)

elif op=="-":
sub(a,b)

elif op=="*":
mul(a,b)


elif op=="/":
div(a,b)


else:
print("Invalid operator")

Use Pycharm or Vscode to use this code.

I hope it is helpful
Thanks for Visiting to my blog



Comments

Post a Comment