Mini Faulty Calculator For Beginners

 # Faulty Calculator.

# Python program for beginners.


Hello ! Guys last time we saw the calculator .This time we will make Faulty Calculator That means Input given by the user will be shown correctly accept 3 to 4 equations.

That's Equations are 

1) 56 + 9 = 77

2)56 / 6 = 4

3)45 * 3 = 154

Accept these 3 equations all the equal will be correct.



print("First Choice the operation To do Calculation.")

print("Press + For Addition,")
print("Press - For Subtraction,")
print("Press * For Multiplication,")
print("Press / for Division,")
print(" ")
print(" ")


print("Enter the first value")
num1 = int(input())

print("Enter the operation")
num3= (input())

print("Enter the Second value")
num2 = int(input())


if num1 == 56 and num2 == 9 and num3 == "+":
print( "Your solution is 77 ")

elif num1 == 56 and num2 == 6 and num3 =="/":
print( "Your solution is 4 ")

elif num1 == 45 and num2 == 3 and num3 == "*":
print(" Your solution is 154")

elif num3=="+":
num4 = num1+num2
print( "Your solution is ",num4)

elif num3 =="-":
num4 = num1 - num2
print( "Your solution is ",num4)

elif num3 == "*":
num4 = num1 * num2
print( "Your solution is ",num4)

elif num3 == "/":
num4 = num1 / num2
print( "Your solution is ",num4)

else:
print("Invalid operator")

I hope this will help you to make your own Faulty Calculator.
Use this code in Pycharm or Vscode.
Thanks for visiting to my blog.

Comments

Post a Comment