-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsentences.py
More file actions
25 lines (20 loc) · 720 Bytes
/
sentences.py
File metadata and controls
25 lines (20 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""
This module contains functions that will return the mean, sum,
or median of a list of numbers as a complete sentence.
"""
from statistics import mean
from statistics import median
def printMean(a_list):
'''Returns the mean of a list, rounded to the hundredths, in a complete sentence.'''
m = mean(a_list)
return f"The mean of the numbers provided is {round(m, 2)}."
def printSum(a_list):
'''Returns the sum of a list in a complete sentence.'''
s = sum(a_list)
return f"The sum of the numbers provided is {s}."
def printMedian(a_list):
'''Returns the median of a list in a complete sentence.'''
m = median(a_list)
return f"The median of the numbers provided is {m}."
if __name__ == "__main__":
main()