general: ex3: add solution

This commit is contained in:
Bruno BELANYI 2022-11-21 16:11:52 +01:00
parent e2a6b24076
commit d755f7b377
1 changed files with 22 additions and 0 deletions

22
general/ex3.py Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env python
def solution(n: int) -> bool:
if n < 0:
n = -n
while n:
if n % 2 == 1:
return False
n //= 10
return True
if __name__ == "__main__":
print(solution(0))
print(solution(1))
print(solution(2468))
print(solution(1468))
print(solution(-2468))
print(solution(-2469))