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

PREVIOUS NEXT
Code Example
Python :: pandas unique values to list 
Python :: measure time 
Python :: Remove empty strings from the list of strings 
Python :: shape pandas 
Python :: np.zeros((3,3)) 
Python :: custom jupyter notebook 
Python :: python b before string 
Python :: strp datetime 
Python :: displaying cv2.imshow on specific window position 
Python :: python cocktail sort 
Python :: Find and count unique values of a single column in Pandas DataFrame 
Python :: add column in spark dataframe 
Python :: create or append dataframe to csv python 
Python :: charts in python 
Python :: discord.py send image from url 
Python :: how to reverse array in python 
Python :: replace nan with 0 pandas 
Python :: how to make python open a program/desktop app 
Python :: MAKE A SPHERE IN PYTHON 
Python :: word2number python 
Python :: read file csv in python 
Python :: how to make python file executable 
Python :: string remove in python 
Python :: how to plot labeled data with different colors 
Python :: np array to list 
Python :: font in tkinter 
Python :: insert data in django models 
Python :: python virtual enviroment 
Python :: raku fibonacci 
Python :: python generate list 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =