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
What keyboard command opens the Go To dialog box?
Harlamova29_29 [7]

If you mean the search for a phrase or word function on a page,

Left Ctrl + F

7 0
3 years ago
Read 2 more answers
Where should you look in order to find words as they are used in a variety of contexts?
Elodia [21]
You'd want to look at the <span>glossary.</span>
8 0
3 years ago
Imagery functions as a coding system to help individuals acquire movement patterns. this describes
denis-greek [22]

Answer:

Imagery can be used to develop qualities in yourself you'd like to have — it's like emotional body-building — and using a technique called “Evocative Imagery” you can cultivate courage, patience, tolerance, humor, concentration, self-confidence or any other quality you'd like to embody.

3 0
2 years ago
_____ is responsible for packet forwarding. a. Transmission Control Protocol b. User Datagram Protocol c. Extensible Authenticat
Mazyrski [523]

Answer:

d. Internet Protocol

Explanation:

Internet Protocols suite  are used to transport packets from the host network across other networks. This task is usually performed by optimizing the size of each available packet, which are then forwarded through the internet protocol (IP) address.

Therefore, Internet Protocol is responsible for packet forwarding.

6 0
3 years ago
Personal letterheads are created in the Footer of a document.
Alex_Xolod [135]
The answer is false .

The letterhead is organized with appropriate information on the top and bottom of the letter with most of the space left to enter the letter contents.

hope this helps.
6 0
3 years ago
Other questions:
  • Using the _______ list, you can select the number of photos that will appear on each slide.
    14·1 answer
  • An undesirable jagged appearance is referred to as
    7·2 answers
  • Which of the following would a high school graduate interested in the performing arts most likely do after graduation?
    10·1 answer
  • Choose the best technology device for the
    12·1 answer
  • General equation: y = (89 / 27) - z * x + a / (a % 2) (recall: a is an integer; the 89 and 27 constants in the equation should b
    14·1 answer
  • What is an individual section machine?
    14·1 answer
  • Why are new versions of applications packages released often ​
    9·1 answer
  • What is the difference between = and == in terms of java..?
    6·2 answers
  • The goal of this project is to become familiar with basic Python data processing and file usage. By the end of this project, stu
    8·1 answer
  • which of the following is the most appropriate way to write css style for the font family property in html
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!