Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 3: Partition the Values (3 points) Given two lists of integers lista and lists, write a function partitionLists that takes two list arguments and
Question 3: Partition the Values (3 points) Given two lists of integers lista and lists, write a function partitionLists that takes two list arguments and one optional boolean parameter largerFirst which defaults to False. Your function should return a tuple containing two sorted lists, where the first list is the same length as list A, and the second is the length of list B. All the elements in list A must be less than or equal to those in list B, and the lists should be by default ascending order. If largerFirst is True, then the elements in list A must be greater than or equal to those in list B, and the lists should be in descending order ]: #Your code here print("Are my sample test cases correct?") print("#1", partitionLists([8,2,5,10],[4,5,6,3,7,5,3]) ==([2, 3, 3, 4], [5, 5, 5, 6, 7, 8, 10])) print("#2", partitionLists([1,4,56,723,5,7,34,1],[4,5,543,6,3,45,7,5,432,3,65]) ==([1, 1, 3, 3, 4, 4, 5, 5], [5, 6, 7, 7 print("#3", partitionLists([1,4,56,723,5,7,34,1],[4,5,543,6,3,45,7,5,432,3,65], True) == ([723, 543, 432, 65, 56, 45, 34
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started