From 73290734cf358ef0ecd85b8f1e9691d664e9fdc9 Mon Sep 17 00:00:00 2001 From: Matthew Heal-Kowal Date: Mon, 18 Oct 2021 18:09:07 -0400 Subject: [PATCH 1/2] mhealkow --- main2.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/main2.py b/main2.py index 2f6ad21..cc791ce 100644 --- a/main2.py +++ b/main2.py @@ -2,7 +2,11 @@ def oddOrEven(nums): '''Given an unsorted list of numbers, return a list that indicates if the value at each index is odd (0) or even (1).''' # EXAMPLE: # Given [2, 4, 5, 7, 8, 10], return [1, 1, 0, 0, 1, 1] - return [] + list = [] + for num in nums: + list.append(((num)+1)%2) + + return list def mostOccurences(nums): @@ -10,8 +14,18 @@ def mostOccurences(nums): # Hint: use oddOrEven to test function faster # Hint: use a map # Hint: https://stackoverflow.com/questions/13098638/how-to-iterate-over-the-elements-of-a-map-in-python - return -1 + greatest = 0 + mp={} + for i in nums : + if i in mp : + mp[i] += 1; + else : + mp[i] = 1; + for i in mp: + if(i > greatest): + greatest = i + return greatest def main(): '''The main function is where you will test all of your functions.''' @@ -23,4 +37,4 @@ def main(): # Add any additional test cases if needed if __name__ == "__main__": - main() \ No newline at end of file + main() From cf07df45a039c4f118c63b9f18e3c98ff59fc036 Mon Sep 17 00:00:00 2001 From: Matthew Heal-Kowal Date: Mon, 18 Oct 2021 19:05:37 -0400 Subject: [PATCH 2/2] mhealkow --- .DS_Store | Bin 0 -> 6148 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ac33aa4bdd11336f795d0d3dd8d132e0351b6c19 GIT binary patch literal 6148 zcmeHKJ5Iwu5S4@j3D}kM((