Question

In: Computer Science

this is a python code: QUESTION 1: Input floating point numbers for a, b, c, d...

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.

Solutions

Expert Solution

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:


Related Solutions

Write a Program(code) in Python that performs a large number of floating-point operations and an equal...
Write a Program(code) in Python that performs a large number of floating-point operations and an equal number of integer operations and compares the time required. Please attach an output.
12. The reciprocal search problem is: input: a list L of n floating point numbers output:...
12. The reciprocal search problem is: input: a list L of n floating point numbers output: two elements a, b L such that a*b=1, or None if no such a, b exist Design an algorithm for this problem using the greedy pattern. Write pseudocode for your algorithm below. If you write multiple drafts, circle your final draft. Hint: I expect your algorithm to be relatively simple and to have time complexity O(n2). 13. Perform a chronological step count to derive...
[PYTHON] How do you write a program that first gets a list of floating point numbers...
[PYTHON] How do you write a program that first gets a list of floating point numbers from input. The input begins with an integer indicating the number of numbers that follow. Then input all data values and store them in a list [PYTHON]
In the diagram, which point is at the lowest potential? (a) A (b) B (c) C (d) D
In the diagram, which point is at the lowest potential?(a) A(b) B(c) C(d) D
Represent the following decimal numbers using IEEE-754 floating point representation. A. -0.375 B. -Infinity C. 17...
Represent the following decimal numbers using IEEE-754 floating point representation. A. -0.375 B. -Infinity C. 17 D. 5.25
Write short notes on the following (a) Floating input   (b) setpoint    (c) CMRR
Write short notes on the following (a) Floating input   (b) setpoint    (c) CMRR
Determine the IEEE single and double floating point representation of the following numbers: a) -26.25 b)...
Determine the IEEE single and double floating point representation of the following numbers: a) -26.25 b) 15/2
In coding language C, Write a program in which will use floating point variable (input=232.346) and...
In coding language C, Write a program in which will use floating point variable (input=232.346) and print out: 1. scientific notation form of input. 2. floating point form of input with total width 12 (default right aligned). 3. floating point form of input with total width 12 (default right aligned) and add 0s for unused space. 4. floating point form of input with total width 12 (left aligned). 5. floating point form of input with total width 12 (default right...
Using the simple model for representing binary floating point numbers A floating-point number is 14 bits...
Using the simple model for representing binary floating point numbers A floating-point number is 14 bits in length. The exponent field is 5 bits. The significand field is 8 bits. The bias is 15 Represent -32.5010 in the simple model.
IN C++ PLEASE!!! Design and implement a programming (name it SimpleMath) that reads two floating-point numbers...
IN C++ PLEASE!!! Design and implement a programming (name it SimpleMath) that reads two floating-point numbers (say R and T) and prints out their values, sum, difference, and product on separate lines with proper labels.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT