Question: Why the code is the wrong answer, and how to get the accept answer.(python3) The problem is below the code. Thanks. Language: Python3 c a

Why the code is the wrong answer, and how to get the accept answer.(python3)

The problem is below the code. Thanks.

Why the code is the wrong answer, and how to get theaccept answer.(python3) The problem is below the code. Thanks. Language: Python3 ca Theme: Solarized Light import pickle def insertion_sort(lst): \# loop through the

Language: Python3 c a Theme: Solarized Light import pickle def insertion_sort(lst): \# loop through the list, starting at the second element for i in range( 1 , len(lst)): \# store the current element in a temporary variable temp = lst [i] \# initialize a counter to store the position of the current element j=i \# loop through the sorted portion of the list and find the correct position for the current element while j>0 and temp [j1] : \# shift the element to the right lst[j]=lst[j1] j=1 \# insert the current element at the correct position lst [j]= temp \# read the list of integers from the pickle file with open('input.pkl', 'rb') as f : lst = pickle. load(f) \# perform insertion sort on the list insertion_sort(list) \# return the intermediate result after the second pass print(lst) Status Wrong Answer Submit Description You are given a list of integer numbers encoded in a pickle file. Write a program to return the intermediate result after pass 2 if we apply insertion sort to the given list. Ex: Input : [23,78,45,8,32,56] after pass 2 of insertion sort :[23, 45, 78, 8, 32, 56] Input (From File: input.pkl) A list in a pickle file ("input.pkl") Ex: [23,78,45,8,32,56] Output (To File: stdio.txt) Standard Output: a list Ex:[23, 45, 78, 8, 32, 56] Sample Input 1 Sample Output 1 [23,78,45,8,32,56] [23,45,78,8,32,56] Sample Input 2 Sample Output 2 [98,2,5,9,1,3] [2,5,98,9,1,3] Language: 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!