In: Computer Science
this is a python code:
QUESTION 1:
Input floating point numbers for a, b, c, d and e. calculate the following and display the result.
Mathematical expression ab means a * b in programming context.
QUESTION 2:
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".
Write a Python program for the scenario mentioned above.
Question 2:
Python Code :
#asking user oz of milk the child drank childMilk=int(input("How many oz of milk the child drank ?")) #checking oz of milk the child drank if childMilk>=6: #when baby drank 6 or more oz s of milk print("Baby will sleep well for 5 hours") #print message else: #f the baby drank less than 6 oz, then display print("Baby will not sleep well. So be prepared.")
********************************************
Screen for Indentation :
======================================
Output :
Screen when oz of milk the child drank is greater than 6:
Screen when oz of milk the child drank is less than 6: