import random mean = float(input("Type the Mean and then press enter")) SD = float(input("Type the Standard Deviation and then press enter")) sampleSize = float(input("Type the Size of each Sample and then press enter")) sampleNumber = int(input("Type the Number of Samples and then press enter")) overallSum = 0 for i in range(0,sampleNumber): tempSum = 0; for k in range(0,5): tempSum += random.gauss(mean,SD) overallSum += (tempSum / sampleSize) #print(tempSum / sampleSize); print("\n\nThe mean of these samples is:" , overallSum / sampleNumber) print("This is" , mean- (overallSum / sampleNumber) , "away fromt the actual mean of" , mean)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question