mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
Created mean and median functions
This commit is contained in:
13
mathgenerator/funcs/meanMedianFunc.py
Normal file
13
mathgenerator/funcs/meanMedianFunc.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
.__init__ import *
|
||||||
|
|
||||||
|
def meanMedianFunc(maxlen = 10):
|
||||||
|
randomlist = random.sample(range(1, 99), maxlen)
|
||||||
|
total = 0
|
||||||
|
for n in randomlist:
|
||||||
|
total = total + n
|
||||||
|
mean = total/10
|
||||||
|
problem = f"Given the series of numbers {randomlist}. find the arithmatic mean and mdian of the series"
|
||||||
|
randomlist.sort()
|
||||||
|
median = (randomlist[4]+randomlist[5])/2
|
||||||
|
solution = f"Arithmetic mean of the series is {mean} and Arithmetic median of this series is {median}"
|
||||||
|
return problem, solution
|
||||||
Reference in New Issue
Block a user