From b65357b5ecd66a2e88ec2c937b83ef0546dcb3c0 Mon Sep 17 00:00:00 2001 From: Victoria Duke Date: Fri, 17 Sep 2021 14:40:26 -0700 Subject: [PATCH 1/3] COMMIT MESSAGE --- function_c.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/function_c.py b/function_c.py index deb1023c..5efcf2b4 100644 --- a/function_c.py +++ b/function_c.py @@ -3,8 +3,8 @@ def merge_lists(list_a, list_b): a combination of list_a and list_b without any duplicate elements. """ - pass - + return list(set(list_a) | set(list_b)) if __name__ == "__main__": print(merge_lists([1, 1, 2, 3], [3, 4, 5])) + From 4796f95c5c197f7dde545fa3b46fdfe869dfc80c Mon Sep 17 00:00:00 2001 From: Tirhas Gebreyohannes Date: Fri, 17 Sep 2021 14:43:41 -0700 Subject: [PATCH 2/3] --- function_b.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/function_b.py b/function_b.py index e888b354..215ca8c2 100644 --- a/function_b.py +++ b/function_b.py @@ -7,7 +7,17 @@ def silly_sum(): the user enters 0, or the sum reaches or exceeds 1000 """ - pass + num = int(input('Please enter a number => ')) + sum = 0 + + while num != 0: + sum += num + if sum >= 1000: + break + + num = int(input('Please enter a number => ')) + + return sum if __name__ == "__main__": From c4bd478bbec0e0bdcd67167ec12a294903640e09 Mon Sep 17 00:00:00 2001 From: letypl12 <86847701+letypl12@users.noreply.github.com> Date: Sun, 19 Sep 2021 21:39:37 -0700 Subject: [PATCH 3/3] Update function_a.py function_a --- function_a.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/function_a.py b/function_a.py index 0bc43c29..3b66319e 100644 --- a/function_a.py +++ b/function_a.py @@ -1,7 +1,21 @@ def most_common_value(number_list): """ returns the most common element of the list """ - pass + frequency_index = {} + max_frequency = -1 + most_common_value = None + for num in number_list: + if frequency_index.get(num): + frequency_index[num] += 1 + else: + frequency_index[num] = 1 + + if max_frequency < frequency_index[num]: + max_frequency = frequency_index[num] + most_common_value = num + + return most_common_value + if __name__ == "__main__":