A buddy of mine has asked if I can help him write a dice-rolling app that will do the following tasks:
1. Roll 2-9 six-sided dice (D6).
2. Take the two highest values among the dice rolled.
3. Add those two values together.
As a side task, since his main goal is to compile statistics, he'd like the app to be able to do this over and over and keep 1) the number of times it's run, and 2) what the current average score is.
So, that's what I'm tasked with doing for him (I volunteered), and I need some help as I'm a newb to the extreme. So far I have only the part that takes in the argument for number of dice:
I Googled and found some reference to using <b>random</b> to do my dice rolling via random.rand(1, 6) , but that turned out to be deprecated.Code:import system # Define the number of dice being rolled nod = sys.argv if len(sys.argv) != 2: print "Please enter a single number between 2 and 9."
Anyway, if you guys could offer some hints on how to do the randomness in Python 2.3 I'd appreciate it. I don't want someone to write this for me; I just need some guidance. I can't find any good documentation on it for the later versions of Python; all I keep seeing is the random.rand stuff.