Question: Problem PQ 4 . Modifying and Filling In Python Code. ( a ) [ 6 points ] Here are the formulas for computing the mean,
Problem PQ Modifying and Filling In Python Code.
a points Here are the formulas for computing the mean, and standard deviation, of a
set of values:
The following Python functions returns the mean of the values of a passed list, x using the
formula for the mean, given above.
def meanx:
xsum
for i in rangelenx:
xsum xi
return xsumlenx
Write another Python function which could call the function above to return the standard
deviation of the values of a passed list, x Also for purposes of assigning partial credit
circle the formula for the standard deviation, sigma that you used above.
b points The text file autompg.dat contains lines of automobile mileage data of the
following, tabseparated data where the character is used only to denote the tab locations:
car name model year number of cylinders miles per gallon
For example, the first two lines of the file might look like:
Prius
Escalade
Add Python expressionsstatements to complete the program below, which should read the
data from the file and display it to the screen. Assume car name contains no spaces.
# Open the file
input file.open
# name is of type str
# year and cyls are of type int
# mpg is of type float
printName t Year t # Cylst MPG
# Get input from file
for :
# within for loop body, display that line of data
printfnamet yeart cylst mpg
# end for loop body
# Close the file
input.close
c points
Assume that values is a element list containing measurements from a scientific
experiment, as declared in the Python code below.
Add Python statements that would complete the program below to count the number of
positive values, negative values, and zero values in the list, and complete the code to
write out a message summarizing how many values of each type were found.
values for i in range # LIST DECLARATION
# OTHER CODE TO INITIALIZE values WOULD BE HERE DO NOT WRITE
# DECLAREINITIALIZE YOUR OTHER VARIABLES HERE
for i in :
# end for loop body
# Print statements: COMPLETE AS NECESSARY
printf# of positive entries:
printf# of negative entries:
printf# of zero entries:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
