From e6ccd04fe0053dd9de789f67ab0c888ae3af80fe Mon Sep 17 00:00:00 2001 From: Unix IO <84545108+BertinAm@users.noreply.github.com> Date: Fri, 4 Mar 2022 14:07:54 +0100 Subject: [PATCH] Create Max_Character.py --- November/Day 8/Python/Max_Character.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 November/Day 8/Python/Max_Character.py diff --git a/November/Day 8/Python/Max_Character.py b/November/Day 8/Python/Max_Character.py new file mode 100644 index 0000000..173cfcd --- /dev/null +++ b/November/Day 8/Python/Max_Character.py @@ -0,0 +1,13 @@ +""" written on march 4 2022 by +@BertinAm +the program below can detect the most frquent character in a list of them! +""" +from statistics import mode # statistics module that provides methods like the mode, median, mean etc + + +def most_common(lits): # function definition + common = mode(lits) + return common + + +print(most_common(["c", "d", "t", "c", "c", "r"])) # calling of the function most_common