Uno2K

Aula5 - soma_multiplos

Sep 16th, 2021
652
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def soma_multiplos(a, b):
  2.     r1 = []
  3.     if b > a:
  4.         for i in range(b*10+1):
  5.             if i % b == 0:
  6.                 r1.append(i)
  7.         for c in range(b*10+1):
  8.             if c % a == 0:
  9.                 r1.append(c)
  10.     if a > b:
  11.         for i in range(a*10+1):
  12.             if i % a == 0:
  13.                 r1.append(i)
  14.         for c in range(a*10+1):
  15.             if c % b == 0:
  16.                 r1.append(c)
  17.     remove_repetidos = lambda l: list(sorted(set(l)))
  18.     print(remove_repetidos(r1))
  19.     return sum(remove_repetidos(r1))
  20. print(soma_multiplos(2, 5))
RAW Paste Data