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

  • EddieJ
    Lv 7
    8 months 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))

    • Commenter avatarLogin to reply the answers
  • 8 months ago

    So what part are you having problems with?

    • Commenter avatarLogin to reply the answers
  • Anonymous
    8 months ago


    • Commenter avatarLogin to reply the answers
Still have questions? Get your answers by asking now.