我正在学习如何使用类量排序的银行客户的功能,到目前为止,我已经实现了以下内容:创建一个由货币
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)
我想创建一个排序的功能顾客所花费的金额,但不确定如何去做。
你在哪里希望有这个功能吗?它不能在课堂上。它将在这堂课之外。这个函数将作为一个客户数组的输入。算法将运行在客户的财产上。创建代码的确切问题是什么?你是否希望使用预建的分类方法? – prabodhprakash
你会排序* iterable /容器*,但你似乎还没有一个 –
@prabodhprakash这正是我不确定的。 – ThatOnePythonNoob