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, 21.06.2019 18:30
An attribute on a webpage allows you to set borders and change background colors. true or false
Answers: 1
question
Computers and Technology, 22.06.2019 08:30
Active listen eliminates barries to communication true or false
Answers: 1
question
Computers and Technology, 23.06.2019 02:30
People with high self-esteem: accept their strengths and weaknesses. believe that failed experiences are failures of their whole self. feel good about who they are only when they reach total success. need positive external experiences to counteract negative feelings that constantly plague them.
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Which best describes the role or restriction enzymes in the analysis of edna a. to break dna into fragments that vary in size so they can be sorted and analyzed b. to amplify small amounts of dna and generate large amounts of dna for analysis c. to purify samples of dna obtained from the environment so they can be analyzed d. to sort different sizes of dna fragments into a banding pattern that can be analyzed
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, 28.04.2021 16:50
question
Mathematics, 28.04.2021 16:50
question
Mathematics, 28.04.2021 16:50
question
English, 28.04.2021 16:50