(python )calculator using match case in python switch the particular value between different cases :
#calculator using match case
# it switch the particular value between different cases :
# index:
print("1= Addition")
print("2= Subtractin")
print("3= multiplication")
print("4= division")
# user choice:
choice=int(input("Enter your choice:"))
# match case
match choice:
case 1:
print("Enter two number:")
a,b=int(input()),int(input())
c=a+b
print("sum is:",c)
case 2:
print("Enter two number:")
a,b=int(input()),int(input())
c=a-b
print("subtraction is:",c)
case 3:
print("Enter two number:")
a,b=int(input()),int(input())
c=a*b
print("multipication is:",c)
case 4:
print("Enter two number:")
a,b=int(input()),int(input())
c=a/b
print("division is:",c)
Comments
Post a Comment