Beginners Query - Simple counter problem

Zentrader zentraders at
Fri Sep 7 01:28:46 CEST 2007

On Sep 6, 10:29 am, David Barr <david.barr... at> wrote:
> yields no results.

Since every response so far has answered everything __Except The
Question You Asked__, your code runs fine on my Linux machine and
prints 15.  The error may be before this bit of code so it isn't
getting called.  Add some print statements and try again

def d6(i):
     print "start of d6()"
     roll = 0
     count = 0
     while count <= i:
         print "d6 count =", count, "of", i
         roll = roll + random.randint(1,6)
         count += 1

     print "returning roll =", roll
     return roll

print d6(3)

More information about the Python-list mailing list