Computers and Technology

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

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 08:00, dramaqueenactr2040
Two technicians are discussing the common u-joint. technician a says its input and output speeds should be equal. technician b says that it normally has two yokes. which technician is correct?
Answers: 1
image
Computers and Technology, 22.06.2019 13:00, ajayfurlow
Which option should u select to ignore all tracked changes in a document
Answers: 1
image
Computers and Technology, 22.06.2019 23:00, maxy7347go
Which factor is the most important when choosing a website host? whether customers will make secure transactions the number of email accounts provided the purpose of the website the quality of the host control panel
Answers: 3
image
Computers and Technology, 24.06.2019 01:00, kayranicole1
What shows the web address of the page that is currently displayed in the workspace? status window toolbar location bar internet box
Answers: 1
Do you know the correct answer?
3.14 LAB: Simple statistics for Python
Given 4 floating-point numbers. Use a string formatting...

Questions in other subjects: