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:
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))
Comments
Leave a comment