Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Subtracting over and over solution in Creative category for Is Even by sadra84
def is_even(num: int) -> bool:
# your code here
num+=2 #added for the case of num=0
while num>0:
num-=2
if num==0:
return True
return False
if __name__ == '__main__':
print("Example:")
print(is_even(2))
# These "asserts" are used for self-checking and not for an auto-testing
assert is_even(2) == True
assert is_even(5) == False
assert is_even(0) == True
print("Coding complete? Click 'Check' to earn cool rewards!")
June 16, 2021
Comments: