Welcome again to everybody! Make yourself@home. In the time-honoured tradition of our group, here is the weekly discussion thread.
โ Matrix homeserver and space
โ Theory discussion group on Matrix
โ Find theory on ProleWiki, marxists.org, Annaโs Archive and libgen; audio versions by Socialism For All
You can improve the code by returning n
and 0
respectively, no need to use a loop variable. The while va == 0
is either unnecessary (if it runs once) or can cause an endless loop (since nothing changes between iterations)
Fixed it now!
def Fmmin():
for n in range(2, number):
if number % n == 0:
return n
if n == number - 1 and number - 1 % n != 0:
return 0
def Fmmax():
for n in range(number-1, 1, -1):
if number % n == 0:
return n
if n == 2 and number % n != 0:
return 0