From d33de18627aa6db74a4ba8ff5d0644e9a07f58f1 Mon Sep 17 00:00:00 2001 From: Souvikdeb2612 <62352386+Souvikdeb2612@users.noreply.github.com> Date: Mon, 19 Oct 2020 11:45:49 +0530 Subject: [PATCH] Created mean and median functions --- mathgenerator/funcs/meanMedianFunc.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 mathgenerator/funcs/meanMedianFunc.py diff --git a/mathgenerator/funcs/meanMedianFunc.py b/mathgenerator/funcs/meanMedianFunc.py new file mode 100644 index 0000000..5f06a1c --- /dev/null +++ b/mathgenerator/funcs/meanMedianFunc.py @@ -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