faulty calculator using python
# 45 * 3 = 555, 56+9 = 77, 56/6 = 4
print('''
choose opeartor:
1.add
2.sub
3.mul
4.div
''')
operator=input("enter a operator serial number ")
n1=int(input("enter a number "))
n2=int(input("enter a number "))
if operator=='1':
result=n1+n2
elif operator=='2':
result=n1-n2
elif operator=='3':
result=n1*n2
elif operator=='4':
result=n1/n2
if result==45 * 3:
result=555
elif result==56+9:
result=77
elif result==56/6 :
result=4
Comments
Post a Comment