Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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. In [ ]: #Your code here In [ ]: 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 print("#2", partitionLists([1,4,56,723,5,7,34,1],[4,5,543,6,3,45,7,5, 432,3,65]) print("#3", partitionLists([1,4,56,723,5,7, 34,1],[4,5,543,6,3, 45, 7,5, 432, 3,65)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions