-
Notifications
You must be signed in to change notification settings - Fork 2
/
main2.py
26 lines (21 loc) · 996 Bytes
/
main2.py
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
26
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 []
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
def main():
'''The main function is where you will test all of your functions.'''
# Testing challenge 2
print("\nTesting oddOrEven")
print("EXPECTED:", [1, 1, 0, 0, 1, 1], "\nACTUAL:", oddOrEven([2, 4, 5, 7, 8, 10]))
print("\nTesting mostOccurences")
print("EXPECTED:", 1, "\nACTUAL:", mostOccurences(oddOrEven([2, 4, 5, 7, 8, 10])))
# Add any additional test cases if needed
if __name__ == "__main__":
main()