Computer Science Related Others Courses AvailableThe Best Codder.blogspot.com

How to Find Factors of Number using Python?

How to Find Factors of Number using Python?

 

How to Find Factors of Number using Python?


num=int(input("enter a number"))

factors=[]

for i in range(1,num+1):

    if num%i==0:

       factors.append(i)


print ("Factors of {} = {}".format(num,factors))


Output

enter a number75

Factors of 75 = [3, 5, 15, 25, 75]

Post a Comment

© Python . The Best Codder All rights reserved. Distributed by