Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python find the factors of a number

def findFactors(num: int)->list:
  factors=[]
  for i in range(1,num+1):
     if num%i==0:
         factors.append(i)
  return factors
Comment

py factors of a number

def find_factors(num: int) -> list:
    return [i for i in range(1, num + 1) if num % i == 0]
    
# print(find_Factors(6))
# [1, 2, 3]
Comment

Find the Prime Factors of a Number in Python Language

def Prime_Factorial(n):
    if n < 4:
        return n
    arr = []
    while n > 1:
        for i in range(2, int(2+n//2)):
            if i == (1 + n // 2):
                arr.append(n)
                n = n // n
            if n % i == 0:
                arr.append(i)
                n = n // i
                break
    return arr


n = 210
print(Prime_Factorial(n))
Comment

PREVIOUS NEXT
Code Example
Python :: python printing date 
Python :: virtualenv with specific python version 
Python :: chech box in tkinter 
Python :: python for looop array value and index 
Python :: print time python 
Python :: from sklearn.preprocessing import standardscaler error 
Python :: matplotlib latex non italic indices 
Python :: modify dict key name python 
Python :: read image python 
Python :: how to download a page in python 
Python :: python load pandas from pickle 
Python :: how to make jupyterlab see other directory 
Python :: print key of dictionary python 
Python :: remove all files in a directory mac 
Python :: ros python publisher 
Python :: get all columns names starting with pandas 
Python :: Unable to locate package python3.6-venv 
Python :: pygame python3.8 
Python :: pandas sort columns by name 
Python :: square finder python 
Python :: discord command addrole python 
Python :: python pandas csv to xlsx semicolon 
Python :: Square of numbers in non-decreasing order 
Python :: fruit shop using list in python 
Python :: pickle save 
Python :: python program for geometric progression 
Python :: how to take password using pyautogui 
Python :: how to find the length of a list in scratch 
Python :: pandas filter and change value 
Python :: firefox selenium python 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =