Skip to content

Instantly share code, notes, and snippets.

@ashokbharat
Created May 29, 2017 10:27
Show Gist options
  • Save ashokbharat/43318180dffa1791b2c5e46575b0291d to your computer and use it in GitHub Desktop.
Save ashokbharat/43318180dffa1791b2c5e46575b0291d to your computer and use it in GitHub Desktop.
Divisors
''' To print all divisors of a number'''
num = int(input("Enter a number to print all the divisors"))
new_list = []
for x in range(1,num+1):
if(num%x==0):
new_list.append(x)
else:
continue
print(new_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment