subject

3.14 LAB: Simple statistics for Python
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 />
Ex: If the input is:

8.3
10.4
5.0
4.8
the output is:

2072 7
2071.680 7.125

So far I came up with the following:
num1 = float(input())
num2 = float(input())
num3 = float(input())
num4 = float(input())

avg = (num1+num2+num3+num4)/4
prod = num1*num2*num3*num4
print('%d %d'%(avg, prod))
print('%0.3f %0.3f'%(avg, prod))

I keep getting this output and I don't know what I'm doing wrong:
7 2071
7.125 2071.680
Expected output should be:
2072 7
2071.680 7.125

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 00:30
Jenny wants to look at row 345 and compare it to row 17. what can she do if she wanted to easily adjust to see both at once?
Answers: 3
question
Computers and Technology, 22.06.2019 04:30
There is a simple pattern for determining if a binary number is odd. what is it and why does this pattern occur? how many bits would you need if you wanted to have the ability to count up to 1000? how high could you count in binary if you used all 10 of your fingers as bits? (finger up means 1, finger down means 0)
Answers: 3
question
Computers and Technology, 22.06.2019 10:50
A911 dispatcher is the sole sender of messages to all police officers. while on patrol, officers communicate with the dispatcher who, in turn, relays messages to other officers. the officers do not communicate directly with one another. this illustrates a network.
Answers: 1
question
Computers and Technology, 23.06.2019 12:30
How is the brightness of oled of the diaplay is controled
Answers: 1
You know the right answer?
3.14 LAB: Simple statistics for Python
Given 4 floating-point numbers. Use a string formatting...
Questions
question
Mathematics, 23.04.2020 20:16
question
Arts, 23.04.2020 20:17
question
Social Studies, 23.04.2020 20:17
Questions on the website: 13722367