Advertisement
daegron

3

Nov 2nd, 2021
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. def div(num: str, division: int):
  2.  
  3.     if division == 10: return num[-1] == "0"
  4.  
  5.     elif division == 4: return int(num) % 4 == 0
  6.  
  7.     elif division == 2: return int(num) % 2 == 0
  8.  
  9.     elif division == 5: return int(num[-1]) % 5 == 0
  10.  
  11.     else:
  12.  
  13.         if len(num) < 3: return False
  14.         else: return int(num) % 8 == 0
  15.  
  16.  
  17. N = input()
  18. num, lst, res = N[-3:], [2, 4, 5, 8, 10], [1]
  19. for i in lst:
  20.  
  21.     if div(num, i):
  22.         res.append(i)
  23.  
  24. print(res)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement