Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In a simple dice game, rolling a 5 or 6 is considered a win and rolling a 1, 2, 3, or 4 is considered a

In a simple dice game, rolling a 5 or 6 is considered a win and rolling a 1, 2, 3, or 4 is considered a loss. use "python"

What is the probability of winning? __________________

What is the probability of losing? ____________________

Write a Python program that will count the total number of wins and losses for the number of rolls specified in the List, numRolls, shown below. For each of the values in numRolls, output the percent wins and percent losses.

numRolls = [10 100 1000 10000 100000 1000000]

To generate a dice roll in Python, do the following:

import random

roll = random.randint(1,6) # Randomly generates an integer from 1 to 6

heres a exasmple of how it should look

Example of Program Output (Results will vary since roll is random):

For 10 Rolls

Percent Wins: 10.0

Percent Losses: 90.0

For 100 Rolls

Percent Wins: 41.0

Percent Losses: 59.0

For 1000 Rolls

Percent Wins: 33.2

Percent Losses: 66.8

For 10000 Rolls

Percent Wins: 32.98

Percent Losses: 67.02

For 100000 Rolls

Percent Wins: 33.109

Percent Losses: 66.891

For 1000000 Rolls

Percent Wins: 33.3036

Percent Losses: 66.6964

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions

Question

Why is selecting a supplier so important?

Answered: 1 week ago

Question

3. What do you think? Are these sales letters convincing?

Answered: 1 week ago