subject

Given 4 floating-point numbers. Use a string formatting expression with conversion specifiers to output their product and their average as integers (rounded), then as floating-point numbers. Output each rounded integer using the following:
print('{:.0f}'.format(your_value))< br /> Output each floating-point value with three digits after the decimal point, which can be achieved as follows:
print('{:.3f}'.format(your_value))< br /> My original code:
import math
num1 = float(input())
num2 = float(input())
num3 = float(input())
num4 = float(input())
num_product_float = num1 * num2 * num3 * num4
num_product = int(num_product_float)
num_average_float = (num1 + num2 + num3 + num4) / 4
num_average = int(num_average_float)
print('{:.0f} {:.0f}'.format(num_product, num_average))
print('{:.3f} {:.3f}'.format(num_product_float, num_average_float))
Input: 8.3 10.4 5.0 4.8
My output
2071 7 2071.680 7.125
Expected output
2072 7 2071.680 7.125

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:00
Which is a false statement considering copyright law? a. when people upload something to the internet they automatically receive a copyright for the work b. the work does not have to contain a copyright notice to be considered having a copyright c. copyright is legal term describing rights given to the creators for literary and artistic works d. personal pictures are always covered by copyrights
Answers: 1
question
Computers and Technology, 23.06.2019 14:00
In which job role will you be creating e-papers, newsletters and preiodicals
Answers: 1
question
Computers and Technology, 24.06.2019 18:30
Dereck works for long hours on his computer.  he frequently experiences physical strain by the end of the day because he does not follow an important rule of ergonomics with respect to the use of keyboards.  which of the following actions of dereck could lead to physical strain? a.  placing the keyboard exactly in front of him while typingb.  keeping hands and wrists straight while typingc.  using wrist pads throughout the dayd.  pounding at the keys on the keyboard while typinge.  resting his hands on the keyboard when he is not typing
Answers: 1
question
Computers and Technology, 24.06.2019 23:00
The valves of the heart and veins are similar in that they both
Answers: 1
You know the right answer?
Given 4 floating-point numbers. Use a string formatting expression with conversion specifiers to out...
Questions
question
Mathematics, 24.10.2021 21:50
question
Mathematics, 24.10.2021 21:50
question
Arts, 24.10.2021 21:50
Questions on the website: 13722361