## Description

# Introduction

*Descriptive statistics* are quantities used for summarizing a data sample. Examples include the *sample mean* and the *sample variance*. Given a set of samples, , the sample mean is defined as

The (unbiased) sample variance is then defined as

In certain applications (e.g. real-time systems), it is important to be able to compute these quantities using an *online algorithm*. An online algorithm computes as the data is coming in, piece-by-piece, rather than waiting until all the data is available.

An online algorithm for computing the sample mean and variance starts with, where are the sample mean and variance for points, respectfully. Then, for each new sample point, the quantities are updated using the following formulas:

and

# Requirements

You are to create a program using Python that asks the user for a nonnegative number, then computes the mean and variance using the above given formulas which should be displayed on the console screen. The program should end when a user enters a negative number.

# Additional Requirements

- The name of your source code file should be py. All your code should be within a single file.
- Your code should follow good coding practices, including good use of whitespace and use of both inline and block comments.
- You need to use meaningful identifier names that conform to standard naming conventions.
- At the top of each file, you need to put in a block comment with the following information: your name, date, course name, semester, and assignment name.
- The output of your program should
**exactly**match the sample program output given at the end.

# What to Turn In

You will turn in the single OnlineStats.py file using BlackBoard.

**Sample Program Output **

70-510, [semester] [year]

NAME: [put your name here]

PROGRAMMING ASSIGNMENT #1

Enter a number: 1

Mean is 1.0 variance is 0

Enter a number: 2

Mean is 1.5 variance is 0.5

Enter a number: 3

Mean is 2.0 variance is 1.0

Enter a number: 4

Mean is 2.5 variance is 1.66666666667

Enter a number: 5

Mean is 3.0 variance is 2.5

Enter a number: 6

Mean is 3.5 variance is 3.5

Enter a number: 7

Mean is 4.0 variance is 4.66666666667

Enter a number: 8

Mean is 4.5 variance is 6.0

Enter a number: 9

Mean is 5.0 variance is 7.5

Enter a number: 10

Mean is 5.5 variance is 9.16666666667

Enter a number: -1