Related questions
Write a python
[You cannot use python build-in sort() function, you can call your own sort function or copy your code from previous tasks instead]
=====================================================
Sample Input 1
list_one = [1, 2, 1, 4]
list_two = [5, 4, 1]
Sample Output 1
Sorted list = [1, 1, 1, 2, 4, 4, 5]
Median = 2
=====================================================
Sample Input 2
list_one = [1, 7, 9, 10]
list_two = [2, 7, 6, 5]
Sample Output 2
Sorted list = [1, 2, 5, 6, 7, 7, 9, 10]
Median = 6.5
#todo
#You can use math functions like math.floor to help the calculation
import math
def task7(list_in_1, list_in_2):
# YOUR CODE HERE
return median
please only use list_in_1, list_in_2 and return median no other function allowed and return median please use only them and no sort function thank you so much
Step by stepSolved in 2 steps with 1 images
- Write a python program that takes two lists, merges thetwo lists, sorts the resulting list, and then finds the median of theelements in the two lists. **<font color='red'>[You cannot use python build-in sort() function, you can call your own sort function or copy your code from previous tasks instead]</font>** ===================================================== **Sample Input 1** list_one = \[1, 2, 1, 4\] list_two = \[5, 4, 1\] **Sample Output 1** Sorted list = \[1, 1, 1, 2, 4, 4, 5\] Median = 2 ===================================================== **Sample Input 2** list_one = \[1, 7, 9, 10\] list_two = \[2, 7, 6, 5\] **Sample Output 2** Sorted list = \[1, 2, 5, 6, 7, 7, 9, 10\] Median = 6.5 this is my code but its not returning median #todo#You can use math functions like math.floor to help the calculation import math def task7(list_in_1, list_in_2): # YOUR CODE HERE list_in_1.extend(list_in_2) sort_list=[] while list_in_1: min=list_in_1[0] for...arrow_forwardCan you use Python programming language to to this question? Thanksarrow_forwardwrite a Python function that takes in a list of integers (elements), checks whether the list is sorted or not, and returns True of False accordingly. You MUST provide the most efficient algorithm in terms of its time and space complexity. What is the time and space complexity of your algorithm/function? def is_sorted(my_list)arrow_forward
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education