![]() |
| This is a faulty calculator. It shows right answers except some particular questions. This calculator has same pros as well as some cons. |
HOW TO RUN THIS CODE:-
Download any python running IDE to run this code.
HERE's THE CODE :-
a = int(input("Enter Any Number : \n==> "))b = int(input("Enter Another Number : \n==> "))
c = input("Enter Any of the following operations to carry out the calculations :- \n 1. + \n 2. - \n 3. * \n 4. / \n==> ")
if (a == 45 and b == 3 and c == "*") :
print("The answer is" , 55)
elif (a == 56 and b == 9 and c == "+") :
print("The answer is" , 77)
elif (a == 56 and b == 6 and c == "/") :
print("The answer is" , 4)
elif (c == "+") :
print("The answer is" , a + b)
elif (c == "-") :
print("The answer is" , a - b)
elif (c == "*") :
print("The answer is" , a * b)
elif (c == "/") :
print("The answer is" , a / b)
else :
print("Sorry , an unexpected error occured !. Please try again later.")
huy = input("If You Want To Continue Then Press y Otherwise Press Any Thing To Leave.\n==> ")
def hai() :
a = int(input("Enter Any Number : \n==> "))
b = int(input("Enter Another Number : \n==> "))
c = input("Enter Any of the following operations to carry out the calculations :- \n 1. + \n 2. - \n 3. * \n 4. / \n==> ")
if (a == 45 and b == 3 and c == "*") :
print("The answer is" , 55)
elif (a == 56 and b == 9 and c == "+") :
print("The answer is" , 77)
elif (a == 56 and b == 6 and c == "/") :
print("The answer is" , 4)
elif (c == "+") :
print("The answer is" , a + b)
elif (c == "-") :
print("The answer is" , a - b)
elif (c == "*") :
print("The answer is" , a * b)
elif (c == "/") :
print("The answer is" , a / b)
else :
print("Sorry , an unexpected error occured !. Please try again later.")
if(huy!="y") :
print('Thanks For Using My Calculator.' )
while(huy=="y") :
hai()
huy = input("If You Want To Continue Then Press y Otherwise Press Any Thing To Leave.\n==> ")
if(huy!="y") :
print('Thanks For Using My Calculator.' )
break
elif(huy=="y") :
continue

Comments
Post a Comment