hello. I really need help with this assignment.
the assignment is this:
splitAround(num s, pivot), where nums is an arbitrary list of numbers, and pivot is an arbitrary integer.
splitAround should return a dictionary, with two keys - "above" and "below". "below" should represent a list of values from nums, that are lesser than pivot, and "above" should represent a list values that are greater than pivot.
For example:
splitAround([5, 4, 10, 3], 4) => {"below": [3], "above": [5, 10]}
I started writing something along the lines of
y = {"above":[], "below":[]}
def splitAround(num bers):
y = []
for x in numbers:
if x > p:
return ["above"]
if x < p:
return ["below"]
the assignment is this:
splitAround(num s, pivot), where nums is an arbitrary list of numbers, and pivot is an arbitrary integer.
splitAround should return a dictionary, with two keys - "above" and "below". "below" should represent a list of values from nums, that are lesser than pivot, and "above" should represent a list values that are greater than pivot.
For example:
splitAround([5, 4, 10, 3], 4) => {"below": [3], "above": [5, 10]}
I started writing something along the lines of
y = {"above":[], "below":[]}
def splitAround(num bers):
y = []
for x in numbers:
if x > p:
return ["above"]
if x < p:
return ["below"]
Comment