Code for faulty calculator whose outcomes will be wrong on these conditions and true results for other calculations using IfElse Statement:
55+6=77
56-4=7
45*3=77 and
56/6=4
inp = input("Enter a Operator you want to use" "+,-,*,/\n") a = int(input("Enter first number: ")) b = int(input("Enter Second number: ")) if inp=='+': if a==56 and b==6: print("Sum is 77") else: print("Sum is", int(a) + int(b)) if inp=='-': if a==56 and b==4: print("Difference is 7") else: print("Difference is", int(a) - int(b)) if inp=='*': if a==45 and b==3: print("Product is 77") else: print("Product is", int(a) * int(b)) if inp=='/': if a==56 and b==6: print("Division is 4") else: print("Division is", int(a) / int(b)) else: print("Enter a valid Operator")
Output for other calculations:
Output for given faulty calculations: