Hi! I'm new to programming and I need help with my phyton code for a calculator. Here's what the calculator needs to do:
- Every time the function runs, it takes three inputs: first number, the operation (either of +, -, * or /).
If the operation is anything other than the above-given ones, a suitable message shows up
The result of the operation is displayed at the end.
- *** The calculator should keep running unless interrupted by Ctrl-C.
- *** The function should never crash. Include exception handling at suitable locations to avoid falling into any errors (exceptions).
- ***The file you submit should have the function call to this function too.
What I marked with *** is what I'm having the most trouble with.
This is the calculator running:
Here's what I have so far:
a = int(input())
b = input()
c = int(input())
if b== "+" :
elif b == "-":
print(a - c)
elif b == "*":
elif b == "/":
print(a / c)
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)