Skip to content

Instantly share code, notes, and snippets.

@rajinwonderland
Last active November 30, 2019 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajinwonderland/f3652feb037960bac41c5121f48cb8de to your computer and use it in GitHub Desktop.
Save rajinwonderland/f3652feb037960bac41c5121f48cb8de to your computer and use it in GitHub Desktop.
Print Factors
# For printing factors of a given number
# i.e print_factors(2) => 1, 2
def print_factors(x):
print("The factors of",x,"are:")
for i in range(1, x + 1):
if x % i == 0:
print(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment