Doesnt dubug #!/user/bi9n/python def add(x, y): (x + y) def subtract(x, y): (x -
ID: 3794796 • Letter: D
Question
Doesnt dubug
#!/user/bi9n/python def add(x, y): (x + y) def subtract(x, y): (x - y) def multiply(x, y): (x * y) def divide(x, y): (x / y) def exp(x, y): (x ** y) def mod(x, y): (x % y) print("Select any one operation what you want to perform.") print("1.Add") print("2.Subtract") print("3.Multiply") print("4.Divide") print("5.Exponent") print("6.Remainder") choice = input("Enter choice(1/2/3/4/5/6):") num1 = int(input("Enter first number: ")) num2 = int(input("Enter second number: ")) if choice == '1': "print(num1,+,num2,=, add(num1,num2)) elif choice == '2': print(num1,"+" #2 =,(num1+num2)) elif choice == '3': print(num1,"*",num2,"=", multiply(num1,num2)) elif choice == '4': print(num1,"/",num2,"=", divide(num1,num2)) elif choice == '5': print(num1,"**",num2,"=", exp(num1,num2)) elif choice == '6': print(num1,"%",num2,"=", mod(num1,num2)) else: print("Invalid input")
Explanation / Answer
This program looks like correct.
In each print statement, whenver you will print any number with string the use str.
Ex: print(str(num1),"**",str(num2),'=',str(exp(num1,num2))
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.