LAB: Simple statistics
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))
Output each floating-point value with three digits after the decimal point, which can be achieved as follows:
print('{:.3f}'.format(your_value))
Ex: If the input is:
8.3
10.4
5.0
4.8
the output is:2072 72071.680 7.125

Respuesta :

Answer:

n1 = float(input())

n2 = float(input())

n3 = float(input())

n4 = float(input())

product = n1 * n2 * n3 * n4

average = (n1 + n2 + n3 + n4) / 4

print('{:.0f}'.format(product) + ' {:.0f}'.format(average) + ' {:.3f}'.format(product) + ' {:.3f}'.format(average))

Explanation:

Ask the user to enter 4 numbers as float

Calculate the product, multiply each number

Calculate the average, sum the numbers and divide the sum by 4

Print the results in requested formats

ACCESS MORE