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

Consider the Boston tea party and the protests to start the country. What movements in history...
Consider the Boston tea party and the protests to start the country. What movements in history have caused social or governmental change? Can you relate any of these historical movements to any movements or social protests in today’s time?
At a recent halloween party, the women appeared to be consuming more packages of halloween candy...
At a recent halloween party, the women appeared to be consuming more packages of halloween candy than were the men. If the mean number of packages consumed by the 3 men was 4, and that for the 7 women was 6, and the standard deviation for the whole group was 2 packages, what was the correlation between gender and the number of packages consumed? I had used the the point-biserial correlation coefficient equation and had gotten 0.46. Is this correct?...
At a recent halloween party, the women appeared to be consuming more packages of halloween candy...
At a recent halloween party, the women appeared to be consuming more packages of halloween candy than were the men. If the mean number of packages consumed by the 3 men was 4, and that for the 7 women was 6, and the standard deviation for the whole group was 2 packages, what was the correlation between gender and the number of packages consumed? I am having difficulties understanding how to solve this homework problem.
Historiy. Compare and contrast the origins and growth of the modern-day Tea Party movement with those...
Historiy. Compare and contrast the origins and growth of the modern-day Tea Party movement with those of the Populist Party. Familiarize yourself with the conditions associated with each party.
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?
The example of Americans drinking green tea and people in China now having Starbucks is an...
The example of Americans drinking green tea and people in China now having Starbucks is an example of: Cultural diffusion Cultural lag Cultural shock Cultural capital
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT