Sorting Algorithm (from Number sorting algorithm from scratch) in Python
I am attempting to write a Python program where I have to create a sorting algorithm without the assistance of the built-ins (like the sort()
function). I used the def
keyword to create the sorting_function()
(the code bits in this paragraph will make more sense once you see my code) so all I have to do at the end is call the sorting_function
(P.S.this is where the original_list
needs to be passed as a parameter). My code(almost) works, but my concern is, how do I pass the original_list
(or the user's input) as a parameter of the function? Instead of having my program edited by the user (where they have to go to the bottom of the program to insert the numbers of their list) for it to work? Also, silly me, the user is still going to edit the program, but it's easier and required to pass the original_list
as a parameter of the sorting_algorithm
function.
I hope my question isn't too vague, and if I can provide any further details, please let me know.
After a couple of hours of trial and error I have (I think) finally figured out a better way to write this code. And the list is a parameter for my function!. Thank you for all the help I got!!.
Could someone please let me know why I need the return list
statement before printing the sorted list (I believe it's line 8)?
Sorting Algorithm (from scratch) in Python
I am attempting to write a Python program where I have to create a sorting algorithm without the assistance of the built-ins (like the sort()
function). I used the def
keyword to create the sorting_function()
(the code bits in this paragraph will make more sense once you see my code) so all I have to do at the end is call the sorting_function
(P.S.this is where the original_list
needs to be passed as a parameter). My code(almost) works, but my concern is, how do I pass the original_list
(or the user's input) as a parameter of the function? Instead of having my program edited by the user (where they have to go to the bottom of the program to insert the numbers of their list) for it to work? Also, silly me, the user is still going to edit the program, but it's easier and required to pass the original_list
as a parameter of the sorting_algorithm
function.
I hope my question isn't too vague, and if I can provide any further details, please let me know.
After a couple of hours of trial and error I have (I think) finally figured out a better way to write this code. And the list is a parameter for my function! Thank you for all the help I got!!
Could someone please let me know why I need the return list
statement before printing the sorted list (I believe it's line 8)?
Number sorting algorithm from scratch
I am attempting to write a Python program where I have to create a sorting algorithm without the assistance of the built-ins (like the sort()
function). I used the def
keyword to create the sorting_function()
(the code bits in this paragraph will make more sense once you see my code) so all I have to do at the end is call the sorting_function
(this is where the original_list
needs to be passed as a parameter). My code works, but my concern is, how do I pass the original_list
(or the user's input) as a parameter of the function? Instead of having my program edited by the user (where they have to go to the bottom of the program to insert the numbers of their list) for it to work? Also, silly me, the user is still going to edit the program, but it's easier and required to pass the original_list
as a parameter of the sorting_algorithm
function.
After a couple of hours of trial and error I have (I think) finally figured out a better way to write this code. And the list is a parameter for my function. Thank you for all the help I got.
Sorting Algorithm (from scratch) in Python **Updated**
Sorting Algorithm (from scratch) in Python **Updated**
Could someone please let me know why I need the return list
(line 8, I believe) statement before printing thesorted list (I believe it's line 8)?
Sorting Algorithm (from scratch) in Python
Could someone please let me know why I need the return list
(line 8, I believe) statement before printing the list?
Sorting Algorithm (from scratch) in Python **Updated**
Could someone please let me know why I need the return list
statement before printing thesorted list (I believe it's line 8)?