Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi guys i need help please I have python homework it is ( starting out with pyth

ID: 3579049 • Letter: H

Question



Hi guys i need help please
I have python homework it is ( starting out with python third edition)
Python program 3.3
I already did it but i need you please to edit all of them i want different names and the code way Using the numbers that i posted it is actually txt file but I copied it
Thank you










import math
def standardDeviation(list):
total=0 m=mean(list)
for number in list: total+=math.pow(number-m,2)
variance=total/(float)(len(list)) sd=math.sqrt(variance)
return precise_float(sd)


def mean(list):
total=0
for number in list: total+=number
average=total/(float)(len(list)) return average

def precise_float(num): return "%0.2f" % num
def main():
f=open('numbers.txt','r') number_list=[]
for line in f: line.strip(' ') number_list.append(int(line))
print("Mean of the list of numbers is: "+ precise_float(mean(number_list))) print("Standard deviation of the list of numbers is: "+standardDeviation(number_list))
main()









17 3 17 7 13 14 6 20 10 2 5 17 20 9 2 16 15 5 10 8 7 7 9 12 2 2 19 4 11 4 20 15 20 11 6 14 18 14 16 12 10 11 10 2 1 16 10 14 15 5 8 14 2 18 1 19 9 20 8 17 1 17 16 8 11 1 8 15 13 5 4 3 9 12 20 9 19 17 14 5 4 20 20 15 3 16 2 6 15 8 17 10 1 9 4 4 8 2 3 15 11 3 4 17 14 13 2 17 8 3 11 4 18 19 5 8 1 18 17 13 11 9 7 9 13 12 6 20 5 2 3 16 4 11 10 8 4 15 8 5 12 18 13 5 3 4 11 1 13 3 11 4 15 13 8 1 9 9 13 3 9 15 16 6 5 11 12 16 4 11 6 19 18 18 20 17 6 14 3 8 15 14 1 7 6 17 16 14 10 12 7 20 19 4 14 6 2 12 4 14

import math
def standardDeviation(list):
total=0 m=mean(list)
for number in list: total+=math.pow(number-m,2)
variance=total/(float)(len(list)) sd=math.sqrt(variance)
return precise_float(sd)


def mean(list):
total=0
for number in list: total+=number
average=total/(float)(len(list)) return average

def precise_float(num): return "%0.2f" % num
def main():
f=open('numbers.txt','r') number_list=[]
for line in f: line.strip(' ') number_list.append(int(line))
print("Mean of the list of numbers is: "+ precise_float(mean(number_list))) print("Standard deviation of the list of numbers is: "+standardDeviation(number_list))
main()









17 3 17 7 13 14 6 20 10 2 5 17 20 9 2 16 15 5 10 8 7 7 9 12 2 2 19 4 11 4 20 15 20 11 6 14 18 14 16 12 10 11 10 2 1 16 10 14 15 5 8 14 2 18 1 19 9 20 8 17 1 17 16 8 11 1 8 15 13 5 4 3 9 12 20 9 19 17 14 5 4 20 20 15 3 16 2 6 15 8 17 10 1 9 4 4 8 2 3 15 11 3 4 17 14 13 2 17 8 3 11 4 18 19 5 8 1 18 17 13 11 9 7 9 13 12 6 20 5 2 3 16 4 11 10 8 4 15 8 5 12 18 13 5 3 4 11 1 13 3 11 4 15 13 8 1 9 9 13 3 9 15 16 6 5 11 12 16 4 11 6 19 18 18 20 17 6 14 3 8 15 14 1 7 6 17 16 14 10 12 7 20 19 4 14 6 2 12 4 14

Due: Wednesday, December 14, 2016 no later than 10:00am The standard deviation of an entire population is known as sigma and is calculated using: where x represents each value in the population, u is the mean value of the population, is the summation (or total), and N is the number of values in the population. So, to do this calculation, you need to find the mean of the numbers. To do this, you need to total all the numbers and divide by the number of values. Then you need to total the difference between each number and the mean. Then you need to square this result, divide this square by the N and find the square root of this value. You will need to store the number in a list in order to access them for calculating the mean and then again to calculate the sum of the differences between the numbers and the mean. write a program that reads a file containing numbers. The file, called numbers.txt, can be found in the l kopploutboxlcs 120 02Program AssignmentslChapter 08 folder. Calculate the mean and standard deviation of the numbers from the file and print these values. You must use functions for calculating the mean and calculating the standard deviation. Other functions should be used as needed.

Explanation / Answer

I have modified the block of code to read the numbers from the file and converting them into a list in your code. Also dont forget to give the absolute path for the input file because you might get some error like "unable to read unicodec input" . So if the file is in C drive give C: umbers.txt.

I hope this solution helps.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote