[Tutor] powerball

max baseman dos.fool at gmail.com
Wed Jun 11 18:58:40 CEST 2008


as a fun little project i scripted a powerball program. it seems to  
have a bug in it that i cant find.

from random import randrange
wins=0
win=[]
count =0
while count !=5:
     number=randrange(55)+1
     win.append(number)
     count=count+1
powerball=randrange(42)+1
count=0
win.sort()
while count !=146107962:
     numbers=[]
     count2=0
     while count2 !=5:
         number=randrange(55)+1
     if number in win:
         numbers.append(number)
     else:
         print "lose"
         break
     numbers.sort()
     ball=randrange(42)+1
     if ball==powerball:
         print "win"
print
print
print win, powerball






More information about the Tutor mailing list