Computers and Technology, 11.02.2021 21:10 golderhadashaowtatz
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
Answers: 2
Computers and Technology, 22.06.2019 18:30
If an improvement creates no significant change in a product’s performance, then it is a(n) ? a0 design improvement. (there are no answer choices)
Answers: 1
Computers and Technology, 23.06.2019 23:00
Computer programming is one type of what career
Answers: 1
Computers and Technology, 25.06.2019 01:40
The instantiation of an endpoint in a potential tcp connection is know as
Answers: 1
Computers and Technology, 25.06.2019 04:00
What was the name of the first computer (machine) language?
Answers: 2
Given 4 floating-point numbers. Use a string formatting expression with conversion specifiers to out...
History, 29.05.2020 21:02
Mathematics, 29.05.2020 21:02
Mathematics, 29.05.2020 21:02
History, 29.05.2020 21:02
History, 29.05.2020 21:02
Mathematics, 29.05.2020 21:02
Mathematics, 29.05.2020 21:02
Mathematics, 29.05.2020 21:02
Mathematics, 29.05.2020 21:02
Chemistry, 29.05.2020 21:02