[Tutor] NEWBIE rolling dice script

Robert Garber garber@centralcatholic.org
Tue, 19 Mar 2002 12:32:12 -0500


Hello all,

 Here is my problem I am working on. I am trying to write a small script that roll dice.  I have written it as a function so I can call it as I need it. When I test the function in the interpreter I get the message listed below. Is this telling my function is working?
Why doesn't it print out the formatted string.
After I get this script written I want to use it in an HTML document


import random
def rolldice():
    die1 = random.range(1,7)
    die2 = random.range(1,7)
    
    print "player rolled %d and %d" % (die1, die2,)
play = rolldice
>>> play
<function rolldice at 0180B53C>

ANY help in this area would be great thank you,
Robert