Exercise 5: dice rolling simulator in Python
Institute for Environmental and Spatial Analysis...University of North Georgia
Contents
1 Problem statement
Python provides a pseudo-random number generator in the `random module. We’ll use the `[python]random function from this module to write a dice rolling simulator. This function takes no arguments and returns a pseudo-random ``float'' between $[0,1)$. That is, $0\le\text{random()}<1$. The workflow of this program should be:
- Print “``Roll? ''” and wait for a string input
- If the input is “``done''”, stop
- Take a random number from ``random()''
- Print one of 1–6 based on the random number from step 3
- Go to step 1