number divisors

NBR = int(input('give a number : ')) FACTORS = [] DIVISOR = 1 for DIVISOR in range(2, NBR): if NBR % DIVISOR == 0: FACTORS.append(DIVISOR) print('nontrivial divisors of %d :' % DIVISOR, FACTORS)
This is just a quick python script that will return all divisors in form of a list of an integer.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.