answer.
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
Ann [662]
1 year ago
3

Since you love games of chance, you've decided to participate in a dice-rolling competition. The competition involves rolling th

ree 6-sided dice, and the results of each die are represented by the integers a, b, and c respectively. Scores are calculated according to the following rules:
If all three dice had the same value (a = b = c) then you earn 1000 * a.
If exactly two of them are the same, you earn 500 * x (where x is the value of the two equal dice).
If all of them are different, you earn 100 * min(a, b, c).
Given the values of a, b, and c, your task is to calculate and return your total score.
Example
For a = 3, b = 3, and c = 3, the output should be diceTotalScore(a, b, c) = 3000.
Since all of the dice have the same value, your total score is equal to 1000 * 3 = 3000.
For a = 3, b = 6, and c = 3, the output should be diceTotalScore(a, b, c) = 1500.
Since exactly two of the values are the same (a = c = 3), your total score is equal to 500 * 3 = 1500.
For a = 3, b = 2, and c = 5, the output should be diceTotalScore(a, b, c) = 200.
Since all of these values are different, your total score is equal to 100 * min(a, b, c) = 100 * 2 = 200.
Input/Output
[execution time limit] 4 seconds (py3)
[input] integer a
An integer representing the value of the first die.
Guaranteed constraints:
1 ≤ a ≤ 6.
[input] integer b
An integer representing the value of the second die.
Guaranteed constraints:
1 ≤ b ≤ 6.
[input] integer c
An integer representing the value of the third die.
Guaranteed constraints:
1 ≤ c ≤ 6.
[output] integer
Return your total score
Pleasee use Python
def diceTotalScore(a, b, c):
Computers and Technology
1 answer:
blondinia [14]1 year ago
4 0

Answer:

See attachment for complete program

Explanation:

This imports the random module

import random

The function begins here

def diceTotalScore(a, b, c):

This checks if the outcome of the three dice are the same

<em>     if </em>(a == b == c):<em />

<em>          earnings = 1000 * a </em><em>--->The earnings for this condition is calculated</em>

This checks if the outcome of two dice are the same

<em>     </em>elif ((a == b) or (a == c) or (b == c)):

<em>The following sub conditions checks for the outcomes that are the same</em>

<em>          if </em>(a == b):<em />

<em>               </em>x = a<em />

<em>          elif </em>(a == c):<em />

<em>               </em>x = a<em />

<em>          elif </em>(b == c):<em />

<em>               </em>x = b<em />

<em>          earnings = 500 * x </em><em>--->The earnings for this condition is calculated</em>

This checks if no outcome are the same

<em>     else:</em>

<em>          earnings = 100 * min(a,b,c) </em><em>--->The earnings for this condition is calculated</em>

The function returns then returns earnings    

    return earnings

The main begins here

The next three lines simulate the rolls of three dice

<em>a = random.randint(1,6)</em>

<em>b = random.randint(1,6)</em>

<em>c = random.randint(1,6)</em>

This calls the TotalScore function and returns the earnings

<em>print("Earnings: "+str(diceTotalScore(a, b, c)))</em>

Download txt
You might be interested in
Which XP practice prescribes that "the code [always be] written by two programmers at one machine"?.
damaskus [11]

Answer:

Pair Programming

Explanation:

In Extreme Programming XP, pair programming is a practice in which two programmers work together in a pair at one machine, when writing a code.

One of the two programmers is called the "driver" or developer who writes the code and supervises all the changes made to the program.

The other one is called an "navigator" or observer who provides ideas on how the program should be written, observes or reviews it the program, identify the issues or errors in the code, help in code simplifications.

The two developers implements the program, do coding, review the program and check each other's work. They both are required to be equally skilled in order to implement and test the code. This improves the process of the software development. By working in a pair and reviewing and testing the code together, they develop a better code.

8 0
2 years ago
An aviation tracking system maintains flight records for equipment and personnel. The system is a critical command and control s
sergeinik [125]

Answer:

offline backup solution

Explanation:

In such a scenario, the best option would be an offline backup solution. This is basically a local and offline server that holds all of the flight record data that the cloud platform has. This offline backup server would be updated frequently so that the data is always up to date. These servers would be owned by the aviation company and would be a secondary solution for the company in case that the cloud platform fails or the company cannot connect to the cloud service for whatever reason. Being offline allows the company to access the database regardless of internet connectivity.

5 0
2 years ago
To operate a vehicle in Florida, you must _____.
Fantom [35]
The answer for this would be B.
5 0
2 years ago
Read 2 more answers
Carl knows that water moves through different kinds of soil at different rates. How easily water moves through a soil is known a
Serggg [28]

Answer:

To get the same same results from all pots "amount of water should be same" for all pots.

Explanation:

As Carl want to measure and compare the amount of water that flows in pot in one minute from all all pots. He should keep the amount of water constant for all pots to get the desired results.

6 0
2 years ago
#Write a function called is_composite. is_composite should #take as input one integer. It should return True if the #integer is
malfutka [58]

Answer:

// A optimized school method based C++ program to check  

// if a number is composite.  

#include <bits/stdc++.h>  

using namespace std;  

bool isComposite(int n)  

{  

// Corner cases  

if (n <= 1) return false;  

if (n <= 3) return false;  

// This is checked so that we can skip  

// middle five numbers in below loop  

if (n%2 == 0 || n%3 == 0) return true;  

for (int i=5; i*i<=n; i=i+6)  

 if (n%i == 0 || n%(i+2) == 0)  

 return true;  

return false;  

}  

// Driver Program to test above function  

int main()  

{  

isComposite(11)? cout << " true\n": cout << " false\n";  

isComposite(15)? cout << " true\n": cout << " false\n";  

return 0;  

}

Explanation:

3 0
2 years ago
Other questions:
  • Currently, there are two major techniques used to develop programs and their procedures. name and describe them. html editor key
    11·1 answer
  • Judd puts password protection on all of his files, makes sure not to have any patient information open on his computer when he t
    12·2 answers
  • Write the definition of a function printLarger, which has two int parameters and returns nothing. The function prints the larger
    15·1 answer
  • Write an expression that executes the loop body as long as the user enters a non-negative number. Note: If the submitted code ha
    7·1 answer
  • Write a program that removes all spaces from the given input.
    6·1 answer
  • In this problem, we want to compare the computational performance of symmetric and asymmetric algorithms. Assume a fast public-k
    11·1 answer
  • Which of the following is true of how the Internet has responded to the increasing number of devices now using the network? a) T
    12·2 answers
  • Select the correct answer.
    6·1 answer
  • Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integer
    11·1 answer
  • A record company is using blockchain to manage the ownership of their copyrighted content. The company requires that every time
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!