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
bonufazy [111]
3 years ago
14

Write a function named dice_eval that accepts two parameters representing numeric dice values and returns a string describing th

e results. If the sum of the dice is 7 or 11, return 'Winner!'. If the sum of the dice is 2, 3, or 12, return 'Crxps!'. For all other values, return a string of the form 'Point is xx', where xx is the sum.
Computers and Technology
1 answer:
Zigmanuir [339]3 years ago
4 0

Following are the "dice_eval" method code into python language.

Program Explanation:

  • Defining a method "dice_eval" that takes two variables "d1,d2" in its parametes.
  • Inside the method, multiple conditional statements were used that adds the parameter values and calculates its value which can be defined as follows:
  • In the if block, it adds the parameters and uses or gate that check its value that is equal to 7 or 11. so, it will return a string message that is 'Winner!'.  
  • In the elif block, it adds the parameters and uses or gate that check its value that is equal to 2 or 3 or 12. so, it will return a string message that is ' C r aps ! '.
  • In the else block, it uses a return keyword that adds parameter value and prints a string value.
  • Outside the method "d1,d2" is declared that inputs the value from the user-end, and passes the value into the method, and prints its value.

Program:

def dice_eval(d1, d2):#defining a method dice_eval that takes two parameters

if (d1+d2)==7 or (d1+d2)==11:#defining if block that adds parameter value and use or operator to check its value

return 'Winner!'#return string value

elif (d1+d2)==2 or (d1+d2)==3 or (d1+d2)==12:#defining elif block that adds parameter value and use or operator to check its value

return 'C r aps!'#return string value

else:#defining else block

return 'Point is '+str(d1+d2)#return string value with adding parameter

d1=int(input())#defining d1 that input value

d2=int(input())#defining d2 that input value

print(dice_eval(d1,d2))#calling method and print its return value

Output:

Please find the attached file

Please find the complete code in the attached file.

Learn more:

brainly.com/question/15011927

You might be interested in
Write a C program to read the values of a 6 x 6 2D array from a file, and then produce an output file that contains the transpos
kvv77 [185]

Answer:

Explanation:

#include <stdio.h>

int main()

{

   int arr[5][5], trans [5][5], i, j;

   // Entering elements to the matrix

   printf("\nEnter matrix elements:\n");

   for (i = 0; i < 6; ++i)

       for (j = 0; j < 6; ++j) {

           printf("Enter element a%d%d: ", i + 1, j + 1);

           scanf("%d", &arr[i][j]);

       }

 

   printf("\nThe given input matrix is: \n");

   for (i = 0; i < 6; ++i)

       for (j = 0; j < 6; ++j) {

           printf("%d  ", arr[i][j]);

           if (j == 5)

               printf("\n");

       }

   // Transpose

   for (i = 0; i < 6; ++i)

       for (j = 0; j < 6; ++j) {

           trans[j][i] = a[i][j];

       }

   printf("\nThe output transpose of the matrix:\n");

   for (i = 0; i < 6; ++i)

       for (j = 0; j < 6; ++j) {

           printf("%d  ", trans[i][j]);

           if (j == 5)

               printf("\n");

       }

   return 0;

}

7 0
3 years ago
If we recorded the average U.S. Housing Price every month for the next year, what graphical display is most appropriate to displ
JulijaS [17]

Answer:

Time plot.

Explanation:

A time plot, also known as a time series can be defined as a graphical representation of a pre-defined value (data) against time.

If we recorded the average U.S. Housing Price every month for the next year, the graphical display which  is most appropriate to display the data is a time plot.

Generally, when representing data that changes with respect to time or that are random in nature; a time plot is considered to be the most effective graphical display to use.

In this scenario, the average U.S. Housing Price that is observed should be plotted against the time of occurrence (months) over a year.

3 0
3 years ago
Discuss how a lack of infrastructure in poor communities could contribute to ill-health such as the Unrest looting.​
shutvik [7]

Answer:No service from hospital for injured people

Explanation:

Yes of course

4 0
3 years ago
Consider whether there are additional components that could be added to the IPv4 protocol to enhance its usefulness. What are th
geniusboy [140]

Answer:

There are no additional components that can be added to the IPv4 protocol to improve its utility

Explanation:

The IPv4 protocol was developed in 1983 and is still the most widely used version worldwide. It consists of a 32-bit binary number that is normally represented in decimal notation, with four digits separated by dots that take values between 0 and 255.

This system limits the IPv4 protocol to 4,000 million different addresses, a figure that in the eighties seemed sufficient but that in practice has been scarce due to the revolution of mobile devices and the impending development of the Internet of Things ( IoT) that will trigger the number of devices connected to the network.

So, there are no additional components that can be added to the IPv4 protocol to improve its utility, since the world is running out of IPv4 addresses and is being replaced by IPv6.

Hope this helps!

5 0
3 years ago
A program is run line by line to determine the source of a logic error. Which best describes the specific tool being used?
riadik2000 [5.3K]

Answer:

c

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • What differences in traffic patterns account for the fact that STDM is a cost-effective form of multiplexing for a voice telepho
    10·1 answer
  • In a doubly linked list, every nodecontains the address of the next node and the previousnode except for the ____ node.
    8·1 answer
  • Does the following program represent an algorithm in the strict sense? Why or why not? Count=0 while count (count ! =5): count =
    13·1 answer
  • Suppose the work required to stretch a spring from 1.1m beyond its natural length to a meters beyond its natural length is 5 J,
    14·1 answer
  • Which of the following is not a component of Google Display ads' value proposition?
    9·1 answer
  • ITS MAKING ME TYPE URL CODES NOW!
    6·1 answer
  • How can you make a search phrase more effective?
    8·1 answer
  • Select the correct text in the passage.
    12·1 answer
  • You have learned a lot about the types of careers that are involved with building a playground. Create two job descriptions of p
    7·2 answers
  • Select the correct text in the passage.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!