Python Programming Assignment Help?

Would anyone be willing to help with my assignment?:

You are asked to read 1000 floats from a file, which is provided to you (floats.txt). The floats have to be read into a list.•Within your program you need to create a function insertion_sort(float_list) that takes as argument a list of floating point numbers and sorts it in ascending order (smallest first) using the Insertion Sort algorithm (see below).•After reading the floats from the file into a list, your main program should call the insertion_sort function, then it should: 1) print the now sorted list onto the screen; 2) write the sorted list onto a file (sorted_floats.txt).

3 Answers

Relevance
  • EddieJ
    Lv 7
    4 weeks ago
    Favorite Answer

    Hi, Adriana,

    You should use stepwise refinement, which means that you shouldn't try to write your whole program at once.

    You can start with this:

    myList = [14.7, 29.3, 4.5, 97.5, 8.0]

    def insertion_sort (float_list):

        return float_list [0]

    print (insertion_sort (myList))

  • 4 weeks ago

    So what part are you having problems with?

  • Jay
    Lv 6
    4 weeks ago

    yes­­­­­­­­­­­­­­­

Still have questions? Get your answers by asking now.