Simple Calculator
Easy
Write a Python program that takes two numbers and an operator (+, -, *, /) from the user and performs the calculation.
Handle division by zero gracefully.
Handle division by zero gracefully.
Input
Two numbers and an operator
Output
Result of the operation
Example
Input
10 3 +
Output
10 + 3 = 13
Use if-elif to check the operator. Remember to check for zero before dividing.
⚡ 10 XP on solve
← Back to lesson
Your Solution
Output
Click "Run" to execute your code...
⏳ Loading Python runtime (first run may take a few seconds)...
Log in to submit your solution and earn XP.