Exercise 5: dice rolling simulator in Python

Dr. Huidae Cho
Institute for Environmental and Spatial Analysis...University of North Georgia

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:

  1. Print “``Roll? ''” and wait for a string input
  2. If the input is “``done''”, stop
  3. Take a random number from ``random()''
  4. Print one of 1–6 based on the random number from step 3
  5. Go to step 1