Created
August 21, 2013 22:45
-
-
Save kylelk/6301186 to your computer and use it in GitHub Desktop.
Shows the number of divisors for each number less than 100. shows in bar graph format.
This file contains 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
# | |
# divisors.py | |
# | |
# | |
# Created by Kyle Kersey on 8/19/13 4:33 PM. | |
# | |
# | |
b=1 | |
d = 0 | |
#generates a list of numbers. | |
while b<100: | |
b=b+1 | |
x = 0.0 | |
a = 0 | |
#generates a list of numbers less than b. | |
while x<b: | |
x=x+1 | |
#this will check for divisors. | |
if (b/x)-int(b/x) == 0.0: | |
a=a+1 | |
print b, a*"-" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment