← Library
Tier 1 · statistics

Mean

Arithmetic mean of n values.

Files (1)
MEAN.py118 bytes
def p(s):print(s)
def f():
 n=int(input("n:"))
 s=0.0
 for i in range(n):
  s+=float(input(">"))
 p("m="+str(s/n))
f()
How to use it

Launch MEAN from prgm. The program runs once (no menu).

  1. n: — enter how many numbers you're averaging.
  2. > — type the first value, enter.
  3. Keep pressing > for each subsequent value.

After the last value, output is m= with the arithmetic mean. Program exits automatically.

Example problem

Your last three quiz scores were 80, 90, and 100. What's your average?

  1. Run MEAN.
  2. n:3.
  3. >80, enter.
  4. >90, enter.
  5. >100, enter.
  6. Output: m=90.0.

Average is 90. Verify: (80+90+100)/3 = 270/3 = 90. ✓

TI-84 Plus CE — try before committingoff
TI-84 Plus CE



  (calculator off)

  Press ON to start.
Test cases (1)
IDInputsExpected contains
three-nums3, 2, 4, 6m=4.0