Created
December 3, 2009 03:21
-
-
Save jkern/247853 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/python | |
""" This is a random horizontal histogram. | |
By Eugene Brinkley | |
WIS 290 Fall Block II | |
Midterm Horizontal Histogram | |
Fall Block II 2009""" | |
#Block imports random and generatres 100 random numbers | |
import random | |
#counter = 1 | |
counter = 0 | |
num0 = 0 | |
num1 = 0 | |
#total_numbers = [] You don't need this --jk | |
#while counter <=100: # Let's make this simpler. -- jk | |
while counter < 100: | |
number = random.randrange(0,9) # This is good! You're on the right track! | |
if number == 0: | |
num0 += 1 | |
counter += 1 | |
elif number == 1: | |
num1 += 1 | |
counter += 1 | |
# int(numbers), # Now you're off the track. --jk | |
# total_numbers.append(numbers) Way off ... but I can see what you're trying to do -- jk | |
# print total_numbers, | |
# counter = counter+1 | |
# else: print "end" You don't need this in a while loop -- jk | |
print "0", "*" * num0 | |
print "1", "*" * num1 | |
# You were getting too complicated. Sure there are many ways to use lists. | |
# But here it's not important -- jk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment