Skip to content

Instantly share code, notes, and snippets.

@jkern
Created December 1, 2009 15:26
Show Gist options
  • Save jkern/246366 to your computer and use it in GitHub Desktop.
Save jkern/246366 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
"""Iordan Iotov
WIS 290
Fall Block II"""
import random
#count=0
count = 0
# So the reason is, when you are executing the while loop.
# What are you doing with each of the lists?
# What happens when you run list0=[12,3,4,5,6] then list0=[] ?
# What is the final value of list0?
# You're on the right track.
#while count< 101: # I want 100 digits
while count < 100:
#number = random.randrange(0,10) # I want the first 10, not the first 11.
number = random.randrange(0,9)
if number == 0:
count+=1
star = "*"
list0 = []
list0.append(star)
#number<=100 BTW these don't do anything.
elif number == 1:
count+=1
star = "*"
list1 = []
list1.append(star)
#number<=100
elif number == 2:
count+=1
star = "*"
list2 = []
list2.append(star)
#number<=100
elif number == 3:
count+=1
star = "*"
list3 = []
list3.append(star)
#number<=100
elif number == 4:
count+=1
star = "*"
list4 = []
list4.append(star)
#number<=100
elif number == 5:
count+=1
star = "*"
list5 = []
list5.append(star)
#number<=100
elif number == 6:
count+=1
star = "*"
list6 = []
list6.append(star)
#number<=100
elif number == 7:
count+=1
star = "*"
list7 = []
list7.append(star)
#number<=100
elif number == 8:
count+=1
star = "*"
list8 = []
list8.append(star)
#number<=100
elif number == 9:
count+=1
star = "*"
list9 = []
list9.append(star)
#number<=100
# elif loop == 100: # This won't do what you think it will.
# print list1
else:
break
# Hint.
#for i in list0:
# print i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment