0
WAP to create a simple calculator?
def add(a,b): return a+b def sub(a,b): return a-b def div(a,b): return a/b def mul(a,b): return a*b print ("enter your choice. ") print("1.add") print("2.sub") print("3.div ") print ("4.mul ") Select =input ("enter your choice: ") x=int(input ("enter your first number:- ") y=int(input ("enter your 2nd number :-") if select =='1': print(add(x,y)) if select=='2': print(sub(x,y)) if select =='3': print (div(x,y)) if select =='4': print(mul(x,y)
1 Réponse
+ 1
😊