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
Samuel loves playing the violin, but he feels embarrassed after a classmate posts a video on a social networking site making fun
Ksenya-84 [330]

Answer:

Number 1 would be the answer and most safest one to choose.

4 0
4 years ago
Read 2 more answers
What is an abstract class? (Points : 2) A generalized class used only to create related derived classes
Sphinxa [80]

Answer:

A generalized class used only to create related derived classes

Explanation:

An abstract class is a class which cannot be instantiated on its own. It is defined using an abstract keyword. However, an abstract class can be inherited from and the derived class can actually be instantiated. For example:

abstract class A{

}

class B extends A{

void test(){

}

}

Here class A is an abstract class, while class B inherits from A. Now we can create an instance of class B as follows:

B b = new B();

b.test();

8 0
3 years ago
I’ll give Brainly if u answer all please <br> ASAP
Yuki888 [10]

Answer:

Answers are: 38, 135, 23, 209, 53 & 181 respectively

Explanation:

8 0
3 years ago
The traditional role of a manager is that of a(n):__________ a. encoder. b. sensegiver. c. communication champion. d. informatio
GREYUIT [131]

The traditional role of a manager is that of a(n):<u> information processor.</u>

<u></u>

<h3>What is called as information processing?</h3>

information processing , the acquisition, recording, organization, retrieval, display, and dissemination of information. In recent years, the term has often been applied to computer-based operations specifically. information processing.

<h3>What is information processing in computer?</h3>

Information processing refers to the manipulation of digitized information by computers and other digital electronic equipment, known collectively as information technology (IT). Information processing systems include business software, operating systems, computers, networks and mainframes.

To learn more about Information processing , refer

brainly.com/question/6392847

#SPJ4

7 0
2 years ago
What is a what if analysis in Excel example?
Sergio039 [100]

Answer:

What-If Analysis in Excel allows you to try out different values (scenarios) for formulas. The following example helps you master what-if analysis quickly and easily.

Assume you own a book store and have 100 books in storage. You sell a certain % for the highest price of $50 and a certain % for the lower price of $20.

(i really hope this is what u needed)

4 0
3 years ago
Other questions:
  • What output will the look up formula below produce in relation to the following table?
    11·1 answer
  • Currently, there are two major techniques used to develop programs and their procedures. name and describe them. html editor key
    11·1 answer
  • A statement that highlights an organization's key ethical issues and identifies the overarching values and principles that are i
    6·1 answer
  • Why are computers assigned IP addresses
    15·1 answer
  • A filter is a camera accessory that is mounted on the optical path of the lens.<br> true or false
    6·2 answers
  • When the Hyper-V role is added to a Windows Server 2016 server, the hypervisor creates the individual environments, each of whic
    5·1 answer
  • After pushing the power switch of the PC to the ʺonʺ position, Bob, the PC repair person, realizes that the power-on lights foun
    8·1 answer
  • What does an effect allow you to do in<br> EarSketch?
    15·1 answer
  • What would be printed to the screen when the following program is run?
    11·1 answer
  • An international pharmaceutical company is fully compliant with local and international regulations. However, they suffered a ma
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!