Define a function named food which receives two parameters: an integer value representing the time of the day measured in hours from 0 to 24 and a Boolean value indicating whether a person likes sweets (True) or not (False).
The function should return one single string with a message as follows.
As an example, the following code fragment:
print (food(4,False))
should produce the output:
no food
The solution to your problem is:-
code for it:-
def food(k,s): # defining function food with parameters time and
boolean value.
if(k<6): # checking the time. if it is <6
printing no food.
return("no food")
elif(k>=6 and k<=10 and s==True): # if time is
>6 and time <=10 printing break fast and if he likes sweet
printing marmalade else printing coffe.
return("breakfast,marmalade")
elif(k>=6 and k<=10 and s==False):
return ("breakfast,coffe")
elif(k>=11 and k<15 and s== True): # if time is
>=11 and time is<15 printing lunch and if he likes sweets
printing desserts else only lunch.
return("lunch,dessert")
elif(k>=11 and k<15 and s==False):
return("lunch")
elif(k>=15 and k<22 and s==True): # if time is
>=15 and time is less than 22 printing dinner and if he likes
sweets printing dessert else dinner.
return("dinner,dessert")
elif(k>=15 and k<22 and s==False):
return("dinner")
elif (k>=22 and k<=24): # if time is greater the
22 then no food is available .
return("no food")
print(food(23,True)) # testing the fucntion.
Output for the above code is:-
Thank you.
Define a function named food which receives two parameters: an integer value representing the time of...
In Problem Set 7 you designed and implemented a Message class. This time, let's design and implement a Mailbox class in a file named Mailbox java. Do the following with this class • You may use the Message class from PS 7. You will have to add new features to the Message class from PS 7 as you work through this problem. You are welcome to start with my sample solution if you wish • Suppose there are multiple mail...
Case: Enron: Questionable Accounting Leads to CollapseIntroductionOnce upon a time, there was a gleaming office tower in Houston, Texas. In front of that gleaming tower was a giant “E,” slowly revolving, flashing in the hot Texas sun. But in 2001, the Enron Corporation, which once ranked among the top Fortune 500 companies, would collapse under a mountain of debt that had been concealed through a complex scheme of off-balance-sheet partnerships. Forced to declare bankruptcy, the energy firm laid off 4,000...
CASE 20 Enron: Not Accounting for the Future* INTRODUCTION Once upon a time, there was a gleaming office tower in Houston, Texas. In front of that gleaming tower was a giant "E" slowly revolving, flashing in the hot Texas sun. But in 2001, the Enron Corporation, which once ranked among the top Fortune 500 companies, would collapse under a mountain of debt that had been concealed through a complex scheme of off-balance-sheet partnerships. Forced to declare bankruptcy, the energy firm...
Risk management in Information Security today Everyday information security professionals are bombarded with marketing messages around risk and threat management, fostering an environment in which objectives seem clear: manage risk, manage threat, stop attacks, identify attackers. These objectives aren't wrong, but they are fundamentally misleading.In this session we'll examine the state of the information security industry in order to understand how the current climate fails to address the true needs of the business. We'll use those lessons as a foundation...
Read the following case: Answer the questions accordingly: PLEASE MAKE COPY PASTE AVAILABLE EEOC v. Management Hospitality of Racine 666 F.3d 422 (7th Cir. 2012) OPINION BY DISTRICT JUDGE YOUNG: The Equal Employment Opportunity Commission ("EEOC") brought this action on behalf of two serv- ers, Katrina Shisler and Michelle Powell, who were em- ployed at an International House of Pancakes franchise in Racine, Wisconsin (the "Racine IHOP"), alleging that the servers were sexually harassed in violation of Title VII of...