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

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...
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
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.
In c++   Design and implement a programming (name it SimpleMath) that reads two floating-point numbers (say...
In c++   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. Comment your code properly and format the outputs following these sample runs.
verilog code to implement 32 bit Floating Point Adder in Verilog using IEEE 754 floating point...
verilog code to implement 32 bit Floating Point Adder in Verilog using IEEE 754 floating point representation.
Using Python Question 1 Write an input function. Then use it to supply the input to...
Using Python Question 1 Write an input function. Then use it to supply the input to following additional functions: i) Print multiplication table of the number from 1 to 12. ii) Print the sum of all the numbers from 1 to up the number given. iii) Print if the number supplied is odd or even. Question 2 Write function that asks for input from a user. If the user types 'end', the program exits, otherwise it just keeps going.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT