Files

25 lines
586 B
Python

def any_int(x, y, z):
'''
Create a function that takes 3 numbers.
Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
Returns false in any other cases.
Examples
any_int(5, 2, 7) ➞ True
any_int(3, 2, 2) ➞ False
any_int(3, -2, 1) ➞ True
any_int(3.6, -2.2, 2) ➞ False
'''
if not (isinstance(x, int) and isinstance(y, int) and isinstance(z, int)):
return False
if x == y + z or y == x + z or z == x + y:
return True
return False