les diviseurs d 27un nombre python

Solutions on MaxInterview for les diviseurs d 27un nombre python by the best coders in the world

showing results for - "les diviseurs d 27un nombre python"
Mathilda
03 Feb 2018
1# This function returns a list containing all the factors of a ginven parameters n
2def getFactors(n):
3    # Create an empty list for factors
4    factors=[];
5
6    # Loop over all factors
7    for i in range(1, n + 1):
8        if n % i == 0:
9            factors.append(i)
10
11    # Return the list of factors
12    return factors
13
14# Call the function with a given value
15print (getFactors(256))
Roberto
06 Jan 2017
1#obtenir tous les diviseurs d'un nombre 'n'
2divisor = [d for d in range(1,n+1) if n%d==0]