mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
21 lines
714 B
Python
21 lines
714 B
Python
from .__init__ import *
|
|
from ..__init__ import Generator
|
|
|
|
|
|
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
|
|
|
|
|
|
meanMedian = Generator("Mean and Median", 76,
|
|
"Mean and median of given set of numbers",
|
|
"Mean, Median", meanMedianFunc)
|