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]
2 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]2 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
If you flash UEFI and now your computer is no longer working, is there anything you can do to correct the situation?
Annette [7]

<u>Solution and Explanation:</u>

Unified Extensible Firmware Interface (UEFI) is a software program which connects the computer's firmware to its operating system (OS). UEFI is installed by the manufacturer and the first program to be executed when the computer is not turning on. UEFI or BIOS can be corrupted because of the upgrade error or any other damage.

Launch an automatic BIOS/UEFI recovery of the system so that the previous working best version of UEFI/BIOS is recovered and made available. On successful recovery of the BIOS/UEFI, the computer starts working.

6 0
3 years ago
What is the meaning of ethics? Check all of the boxes that apply
suter [353]

Answer:

behavior that is good for everyone

following the rules

behaving in a way that would be easy to defend

Explanation:

6 0
3 years ago
Which programming term describes the various characteristics of an object, such as its size and color?
SashulF [63]

Answer:

A

Explanation:

6 0
3 years ago
When a customer makes a request or complaint, the goal of customer service is to
Brrunno [24]

Solution:

When a customer makes a request or complaint, the goal of customer service is to show the customer how to remain calm and courteous.

Because the work of the costumer care is  to serve as customers' first point of contact for complaints, questions, requests, feedback, or any other needs; these professionals are essentially charged with managing relationships between clients and the company.

Thus the required answer is D

7 0
2 years ago
How to know the between of Man-made-satelite and space probe when the question only given a diagram and it want a name?
Vilka [71]
A man mad stalemate is a probe it just has a different use.
4 0
3 years ago
Other questions:
  • If you are planning to carry a large balance on your credit card, which of the following credit card features should you look fo
    7·2 answers
  • Criminal Investigation people called my house on an automated voice is this a scam ??
    13·1 answer
  • Question 2 (1 point)
    9·1 answer
  • Given that k refers to a non-negative int value and that t has been defined and refers to a tuple with at least k+1 elements, wr
    12·1 answer
  • Instead of terminating the series, the producers decided to extend it for an additional season. In the sentence above, which of
    13·1 answer
  • What are two preferences a user can indicate for the Junk Email folder?
    15·2 answers
  • When an instruction is sent to the CPU in a binary pattern, how does the CPU know what instruction the pattern means
    7·1 answer
  • Adding Web pages helps Web designers ___. Choose all answers that are correct.
    13·1 answer
  • Taking a group of recipes and identifying the similarities is an example of _____.
    13·1 answer
  • PLEASEEEEE HELLPPP IT'S URGENT!!! PLEASEEEEE HELLPPP IT'S URGENT!!!
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!