Python program that reads two number and an arithmetic operator and display the result

preview_player
Показать описание
Question 6- Write a program that reads two number and an arithmetic operator and display the result.

Class 11 - First Python Assignment solution
#python #pythonprogram

👉Source code is given in the comment box💖💖

Guys if you also want that i solve your question then comment me.

Asked by
Rashmi Singh
Рекомендации по теме
Комментарии
Автор

#write a program that reads two number and an arithmetic operator and display the result.

num1=float(input("Enter first number:"))
num2=float(input("Enter second number:"))

op=input("Enter operator[+ - * / %]")

result=0

if op=="+":
result=num1+num2
elif op=="-":
result=num1-num2
elif op=="*":
result=num1*num2
elif op=="/":
result=num1/num2
elif op=="%":
result=num1%num2
else:
print("Invalid operator!")

print(num1, op, num2, "=", result)

parvatcomputertechnology
Автор

thanks a lot....and make many more videos for class11 and class 12 computer science!!

ramaneshwark
Автор

sir why there is result=0 written before the if else statements

gameobee
Автор

What if
Enter a number 15
Enter another number 7
The sum is 22
The difference is 8
The product is 105

realph
join shbcf.ru