Answer to Question #297663 in Python for sruthi

Question #297663

num1 = int(input("Enter a Number: "))



num2 = int(input("Enter another Number: "))



operator = str(input("Enter the Operation you want: "))




if operator == "+":



print("Result is:" , (num1 + num2))




elif operator == "-":



print("Result is:" , (num1 - num2))




elif operator == "*":



print("Result is:" , (num1 * num2))




elif operator == "/":



print("Result is:" , (num1 / num2))




elif operator == "%":



print("Result is:" , (num1 % num2))




error in output: File "main.py", line 1, in <module>



num1 = int(input())



ValueError: invalid literal for int() with base 10:




1
Expert's answer
2022-02-14T07:54:45-0500
num1 = float(input("Enter a Number: "))
num2 = float(input("Enter another Number: "))
operator = input("Enter the Operation you want: ")


if operator == "+":
	print("Result is:" , (num1 + num2))


elif operator == "-":
	print("Result is:" , (num1 - num2))


elif operator == "*":
	print("Result is:" , (num1 * num2))


elif operator == "/":
	print("Result is:" , (num1 / num2))


elif operator == "%":


	print("Result is:" , (num1 % num2))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS