1.You are sleep expert for a baby that is having struggle sleeping every night. You are to ask the mother of the child "How many oz of milk the child drank ?" Based on the amount of milk, you will have to determine how many hours the baby is going to sleep.
If the baby drank 6 or more oz s of milk, the baby will sleep 5 hours continuously. As a sleep expert, you are to suggest the baby will sleep well. Display "Baby will sleep well for 5 hours"
If the baby drank less than 6 oz, then display "Baby will not sleep well. So be prepared".
2.Write a Python program for the scenario mentioned above.
Hello learner,
Thanks for asking.
#Here is the required python code
n=int(input("Enter the amount of milk in oz that the
child drank:"))
if(n>=6):
print("Baby will sleep well for 5 hours")
else:
print("Baby will not sleep well. So be prepared")
#At first input is taken from the mother in oz and then the condition is used in which if and else statement is used for printing different lines according to the input which is given by the mother.
please upvote and ask if you have any query.
Get Answers For Free
Most questions answered within 1 hours.