1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
andrezito [222]
3 years ago
12

Create a function that should simulate a game involving the rolling of a standard six-sided dice between two players. The functi

on takes in the integer number of rounds, which corresponds to how many games to play. Each game consists of both players rolling the dice five times each, whichever player has the highest average die roll from their five rolls wins the round.
Computers and Technology
1 answer:
Law Incorporation [45]3 years ago
4 0

Answer:

import random

def roll_dice(r):

   score1 = 0

   score2 = 0

   for i in range(r):

       for j in range(5):

           score1 += random.randint(1,6)

           score2 += random.randint(1,6)

           

       avg1 = score1/5

       avg2 = score2/5

       

       if avg1 > avg2:

           print("Player1 won the " + str(i+1) + ". round ")

       elif avg1 < avg2:

           print("Player2 won the " + str(i+1) + ". round ")

       else:

           print("Tie")

       

       score1 = 0

       score2 = 0

           

roll_dice(3)

Explanation:

Import the random module

Create a function called roll_dice that takes one parameter r

Initialize two scores as 0 for the players

Create a nested for loop. The outer loop will simulate the rounds and inner loop will simulate the each roll.

Inside the inner loop which iterates five times, generate random numbers for two players and add these numbers to their score.

When the inner loop is done, calculate the average score of the players. If the first average is greater, player1 wins the round. If the second average is greater, player2 wins the round. Otherwise, it is a tie. Also, set the scores to zero so that they start again.

Call the function with parameter 3, simulating 3 rounds

You might be interested in
Candy Kane Cosmetics (CKC) produces Leslie Perfume, which requires chemicals and labor. Two production processes are available:
Vilka [71]

Answer:

  1. Divide the resources into three parts using the corresponding process 1, process 1, and process 2 formats to maximize the use of the resources.
  2. Get the expected revenue by calculating the product of the total perfume in ounce and the price of an ounce of perfume.
  3. Increase the advertisement hours of the product.
  4. subtract the advert fee from the generated revenue to get the actual revenue.
  5. subtract the cost of production from the actual revenue to get the actual profit.

Explanation:

The get maximum profit, all the resources must be exhausted in production. The labor is divided into a ratio of 1:1:2 ( which is 5000, 5000, 1000), while the chemical units are in the ratio of 2:2:3 (10000,10000,15000). This would produce in each individual processes; 15000, 15000 and 25000 oz, which is a total of 55000 oz of perfume.

The expected revenue is $275000. If 1000oz from the 55000oz of perfume is sold without advertisement, model Jenny's awareness of the perfume increases the demand by 200oz per hour, therefore, 24hours would field 4800oz demanded, which would only take 270 hours to distribute all remaining perfumes.

The cost of production would be $130000 for labor and chemical resources plus the advert cost of $27000 ( 270 hours by 100) which is a total cost of $157000. The actual profit is $118000 ( $275000 - $157000).

3 0
3 years ago
PLS HURRY <br> Look at the image below
fenix001 [56]

Answer:

one sec

what is that called?

if you have more than one try

then you should just take an "EDUCATIONAL GUESS"

it's a 50/50 chance

just take it

Explanation:

<h2><u><em>YOU GOT THIS MAN! :3</em></u></h2>

8 0
3 years ago
Counselors do NOT provide which service during treatment?
Ivan

Answer:

Civil settlement

Explanation:

5 0
3 years ago
Read 2 more answers
Match each vocabulary word to its definition.
Nana76 [90]

Answer:

Column matching given in explanation

1. Intranet :  <em>a network of computer within an organization</em>

2. Placeholder: <em>an empty area that reserves space for new content</em>

3. Presentation: <em>information delivered to an  audience</em>

4: Presentation Technology:  <em>a software application that helps  organize and convey information</em>

5. Keynote:   <em>the main speech delivered to all in attendance</em>

Explanation:

Intranet:

A small network that exist in the small organization or company to connect all the computers in organization.

Placeholder:

In computer programming, few variables has been defined in the start of program. These variables have no value initially but can be utilized at the time of need. These variable holds some space in memory that is called Placeholder.

Presentation:

A piece of information relevant to some particular topic, which will be delivered to a particular audience is called presentation.

Presentation Technology:

The tools that are used to assist presentation such as projector, slides, boards etc. are called presentation technology.

Keynote:

The main idea of speech that presenter want to deliver to the audience is called Keynote.

4 0
3 years ago
A portable electronic device that can be used in an emergency to stop someone’s heart from going out of rhythm is called a/an
JulsSmile [24]
It is called a Heart pace maker
7 0
3 years ago
Read 2 more answers
Other questions:
  • The sum of all the minterms of a boolean function of n variables is equal to 1.
    7·1 answer
  • When sending an electronic cover letter, an e-mail address is sufficient contact information.
    10·2 answers
  • What considerations have to be kept in mind with JPEG
    10·1 answer
  • Approximately, what percentage of Smartphone owners in America uses their mobile devices to access social media platforms?
    7·1 answer
  • Use the following global structure declaration as an example only. You will need to create your own data structure based on a da
    5·1 answer
  • How do you change the text style on brainly mobile ?
    12·1 answer
  • High capacity circuits are limited by the least capable network link, which is typically the user connection. As such, it is imp
    11·1 answer
  • Which web browser was created by Google?
    5·2 answers
  • One problem with _______ is that often many copies of the same document are made. <br><br>HELPPP ​
    11·1 answer
  • What sort of negative outcomes are possible for this type of risk?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!