Last active
November 30, 2019 21:57
-
-
Save rajinwonderland/f3652feb037960bac41c5121f48cb8de to your computer and use it in GitHub Desktop.
Print Factors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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