🛠️ Scheduled Maintenance | We’ll be undergoing scheduled maintenance and upgrades between 00:00 PST Jan 26th until 00:00 PST Jan 28th. There may be brief interruption of services in that period. We apologize for the inconvenience.

The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Anybody can ask a question
Anybody can answer
The best answers are voted up and moderated by our team

Insertion sort in python

Insertion sort in python


In the search  and sort section in the python programming bootcamp I dont understand the insertion sort. 
Below is the code. The part where I put astericks are the parts I dont understand 

Start your code here
Def insertion_sort(my_list)
n = len(my_list)
For I in range(1,n)
Value = my_list[1]
*** J = 1
While j > 0 and my_list[j-1] > value
My_list[j] = my_list[j-1]
J = j -1
My_list[j] = value ********
Return my_list

When the instructor was testing his code he used the bubble sort function instead of the insertion sort function. Is that meant to be so?.
Thank you 

1 Answer

365 Team

Hi Chizom, 
thanks for reaching out! You’re not supposed to use bubble_sort() to test the insertion sort algorithm. You can now download the updated Notebook file from the lecture.
The 365 Team