0
Please tell me how can i take output?
print("select operation") print("1.Add") print("2.Subtract") print("3.Multiply") print("4.Divide") choice =int(input("Enter choice(1/2/3/4):")) num1 = int(input("Enter first number: ")) num2 = int(input("Enter second number: ")) if choice == 1: print (num1+num2) elif choice == 2: print (num1-num2) elif choice == 3: print (num1*num2) elif choice == 4: print (num1/num2) else: print ("Invalid input")
3 Respostas
+ 1
Initially assign result variable to zero the in each operational stmt, instead of directly performing operation in print, assign the operation to result and the peint result.
Like this:
result=0
if ch=1:
result=n1+n2
print(result)
0
Please tell me
0
Siddharth Yadav
You mean how to take input?
https://code.sololearn.com/WhiNb9BkJUVC/?ref=app