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
What are voter purges
diamong [38]

Answer:

Voter registration lists, also called voter rolls, are the gateway to voting because a citizen typically cannot cast a vote that will count unless his or her name appears on the voter registration rolls. State and local officials regularly remove—or purge—citizens from voter rolls. In fact, 39 states and the District of Columbiareported purging more than 13 million voters from registration rolls between 2004 and 2006.

Explanation:

7 0
3 years ago
STAY AWAY FROM AND REPORT mariaivanovaloveyou!!!!!!! SHE IS A BRAINLY USER AND KEEPS POSTING INAPPROPRIATE PICTURES OF HER BODY
Bond [772]

Answer:

Yep, saw her posts. Thanks for the warning though. I reported one of her posts. It's just another example of how desperate people are and what measures they will take to get attention. She'll probably be banned soon

Explanation:

Thank you for the warning though. I hope this reaches more people.

7 0
2 years ago
All digital devices use software programs to function. Software <br> BLANK create these programs.
yarga [219]
Application I think because software used to create a program is called application software I'm not entirely sure about that though
7 0
3 years ago
Congress are smart becuase.....
spin [16.1K]

Answer:

If we are talking about government then they are smart bc of there two house policies, both are equal yet super unique. They make sure each state has an equal voice in the senate.

5 0
2 years ago
Jeremy has created a snippet of JavaScript. Which event handlers will he use to invoke JavaScript from his HTML form?
riadik2000 [5.3K]

Answer:

One of them is OnClick, but there are more.

Explanation:

I took my post test and only clicked OnClick and I missed this one and it says "not all correct answers chosen"

3 0
2 years ago
Read 2 more answers
Other questions:
  • By applying styles formats are being applied ?
    14·2 answers
  • Instructions:Select the correct answer.
    15·2 answers
  • What are 7 good facts on Computer Viruses?
    10·1 answer
  • _____________ refers to know-what and know-why of technology.
    12·1 answer
  • Direct Mapped Cache. Memory is byte addressable. Fill in the missing fields based upon the properties of a direct-mapped cache.
    6·1 answer
  • Which turn best describe news one is connected to the government and is used as a political tool more than as a business product
    12·1 answer
  • Which rotation speed is not a typical spindle rotation speed for magnetic hard drives?3100; 5400; 7200; 10000
    8·1 answer
  • 10(            )  8(532.2 )                         
    15·1 answer
  • I really need help in this!!!
    11·1 answer
  • ________ is interpreted. Group of answer choices A. Python B. C C. C D. Ada E. Pascal
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!