a = int(input()) b = int(input()) d = 1 while d % a != 0 or d % b != 0: d = d + 1 print(d)
While 'the variable d will not be divisible by the first number' And 'variable d will not be divisible by the second number, THEN perform the cycle.
d % a != 0, is either true
d % b != 0
from math import gcd lcm = a * b / gcd(a, b)
from itertools import count, dropwhile lcm = next(dropwhile(lambda d: d % a != 0 or d % b != 0, count(max(a, b))))
Find more questions by tags Python