Question

In: Computer Science

We are having a party with amounts of tea and candy. Print the outcome of the...

We are having a party with amounts of tea and candy. Print the outcome of the party as "Bad Party", "Good Party", or "Great Party". A party is good if both tea and candy are at least 5. However, if either tea or candy is at least double the amount of the other one, the party is great. However, in all cases, if either tea or candy is less than 5, the party is always bad. Write the function:

Examples:
tea: 6, candy: 6 -> "Good Party"
tea: 3, candy: 8 -> "Bad Party"
tea: 20, candy: 6 -> "Great Party"

Solutions

Expert Solution

code:

def party(tea,candy):
if(tea<5 or candy<5):
print("Bad Party")
elif(tea>=2*candy or candy>=2*tea):
print("Great Party")
else:
print("Good Party")

if you have some other cases please comment then i will execute those cases and post the screenshots of them

thankyou


Related Solutions

What is the outcome of having tighter integration within the supply chain?
What is the outcome of having tighter integration within the supply chain?
Provide an example of a third party benefiting from a prisoner’s dilemma outcome while the game...
Provide an example of a third party benefiting from a prisoner’s dilemma outcome while the game participants are worse off relative to other possible outcomes. Also, explain the nature of the benefit. How can a repeated game help in resolving a prisoner’s dilemma outcome? Why is game theory important to economics?
which process of drug therapy indicates that the patient is having a beneficial therapeutic outcome
which process of drug therapy indicates that the patient is having a beneficial therapeutic outcome
2,006 persons are cross classified by disease and exposure. Our outcome of interest is having the...
2,006 persons are cross classified by disease and exposure. Our outcome of interest is having the disease. Use the following 2 x 2 table to answer questions below. Disease No Disease Exposed 9 992 Not Exposed 16 989 a. What percent of people have disease? b. What percent of the exposed persons have disease? c. What is the odds of disease among the exposed? d. What is the odds of disease among the unexposed? e. What is the odds ratio...
1. what are the consequences of the united states having a two party system rather than...
1. what are the consequences of the united states having a two party system rather than a multi party system? what aspects of the U.S political system explain why the US has two party system? 2. Who determines ballotg acces in the American states? why this a relavent concern and what are the consequances? 3. on the heals of the 2016 presidential election, we are seeing much discussion of the role internet and socail media in voter education. what are...
Emma's cousin Jack is having a birthday party in a few weeks. Her whole family is...
Emma's cousin Jack is having a birthday party in a few weeks. Her whole family is planning on going and everyone has bought Jack a present apart from Emma. It is his 10th birthday and the families want to make it memorable as they always do for milestone birthdays. Emma has never been close with Jack and asked her brother Simon for advice as Simon and Jack are best friends. Emma was thinking of buying him a gift card so...
Suppose we are studying the market for beer; the market for candy is perfectly competitive. There...
Suppose we are studying the market for beer; the market for candy is perfectly competitive. There are two types of firms that produce beer, Type A firms and Type B firms. The cost curve of type A firm is represented by CA(y) = y^2 + 5, and the cost curve of a type B firm is represented by CB(y) = ((y^2) / 2 ) + 10. In the short-run, there are 10 Type A firms in the market, and 15...
Why we cannot print money to pay back the debt
Why we cannot print money to pay back the debt
The table below shows the outcome of a crossing of two parents for which we are...
The table below shows the outcome of a crossing of two parents for which we are interested in the trait of color. No two crossings have the same parents genotypically for this trait. Knowing this, fill out the chart below, determine the pattern of inheritance displayed, and indicate the parental genotypes in each cross . Define the term co-dominance and incomplete dominance Cross # # of each Offspring Phenotype Offspring Genotypes Parental Genotypes 1 10 red and 10 green 2...
How do we define the quality of healthcare? Is it the outcome or the experience? Can...
How do we define the quality of healthcare? Is it the outcome or the experience? Can a patient receive excellent quality of care and have a bad outcome—possibly die?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT