Question: Need help with python coding Show all work and steps Problem 1: A game of chance, rolling a single die In the development of probability
Problem 1: A game of chance, rolling a single die In the development of probability theory that underpins much of statistics, the roll of a "fair die" is often cited as a key concept. We want to write a simple program that utilizes a random number generator to mimic the behavior of a fair die and an un-fair die. 1. Create a Python file called Die. py in PyCharm. 2. Create a function called rollFairDie () that takes no arguments and returns an integer between 1 and 6 inclusively, but at random each time the function is called. a. You must import the module random and call the function random () to produce a floating point number between 0.0 and 1.0. b. Convert the floating point number to an integer (1-6) with equal probability by dividing the range 01 into six equal bins and using an if-then structure to return the appropriate integer. For example, we might break the range between 01 into six equal pieces like: x=random() if (x1.0/6) : return 1 else if (x2.0/6) : return 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
