This document provides instructions for a lab exercise to calculate the product and average of 4 floating point numbers as both integers rounded to 0 decimal places and as floating point numbers with 3 decimal places. The student is prompted to take in 4 numbers as input, calculate the product and average, and output each result formatted in the specified integer and floating point formats.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100%(1)100% found this document useful (1 vote)
3K views1 page
3.14 LAB Simple Statistics
This document provides instructions for a lab exercise to calculate the product and average of 4 floating point numbers as both integers rounded to 0 decimal places and as floating point numbers with 3 decimal places. The student is prompted to take in 4 numbers as input, calculate the product and average, and output each result formatted in the specified integer and floating point formats.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
3.
14 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 7 2071.680 7.125