Create a function that sorts customers of the bank by amount of money
<p>I'm learning how to use Classes, so far I have achieved the following:</p>

<pre><code>class customer:
    def __init__ (self, name, ID, money):
        self.name = name
        self.ID = ID
        self.money = money
    def deposit(self, amount):
        self.money = self.money+amount
    def withdraw(self, amount):
        self.money = self.money-amount

mike = customer('Mike', 1343, 1884883)
john = customer('John', 1343, 884839)
steve = customer('Steve', 1343, 99493)
adam = customer('Adam', 1343, 10000)
</code></pre>

<p>I would like to create a function that sorts the customers by the amount of money they have but am unsure about how to do so.</p>

<pre><code>def sort_by_money(customer)
    for index in range(1,len(customer)):
        currentvalue = customer[index].money
        position = index

        while position&gt;0 and customer[position-1].money &gt; currentvalue:
            alist[position]=alist[position-1]
            position = position-1

        customer[position]=customer
</code></pre>

<p>Simple insertion sort that takes in customer array and sorts it back based on money.</p>

<p>This code will be outside your customer class that will take customer array as input.</p>

<p>There can be many correct answer to this problem. Written insertion sort to explain properly. </p>

python python-2.7 function class initialization