Answered You can hire a professional tutor to get the answer.

QUESTION

Here is my dice code. I am not really sure about the doubleStats function here. The problem is to Study the doubleStats function and then run it...

Here is my dice code. I am not really sure about the doubleStats function here. The problem is to Study the doubleStats function and then run it giving 1000 as the argument. Does it produce a value that you would expect? Explain what doubleStats counts.

Also, Study and run the diceStats function. Try to figure out what it does and explain how it works. As a hint, run sum(diceStats(1000)) and explain its results).

def die_roll():

  roll = random.randint(1,6)

  return roll

def dice_roll():

  die1 = die_roll()

  die2 = die_roll()

  return die1 + die2

def doublesStats(trials):

  counter = 0

  for index in range(trials):

    roll1 = die_roll()

    roll2 = die_roll()

    if roll1 == roll2:

      counter = counter + 1

  return counter

def diceStats(trials):

  counterList = [0] * 13

  for counter in range(trials):

    result = dice_roll()

    counterList[result] = counterList[result] + 1

  return counterList

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question