0

I need help

I want to make a faulty calculator which can solve all the problem except 45*3 ==555 56+9==77 56/6==4 Can you please help me And the code must be in python

8th Dec 2021, 9:24 AM
Tarun
Tarun  - avatar
1 Odpowiedź
+ 1
Assuming you've already programmed a calculator Let's take the addition exemple: If you want that behavior only for the input (56 plus 9) than you can handle that case before handing the input to your calculator If you want that behavior everytime there is a sum of 56 (lhs) and 9 (rhs) (eg. 56+3*3) than you need to change your addition operator to something like if (lhs, rhs) == (56, 9): return 77 else: return lhs + rhs
8th Dec 2021, 9:58 AM
Angelo
Angelo - avatar