Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
20 changes: 17 additions & 3 deletions main2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,30 @@ 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):
'''Given an unsorted list of numbers, returns the value that occured the most in 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.'''
Expand All @@ -23,4 +37,4 @@ def main():
# Add any additional test cases if needed

if __name__ == "__main__":
main()
main()