This commit is contained in:
marcel-dempers 2021-08-27 19:39:47 +10:00
parent ea0634f207
commit fdeec671de

View File

@ -1,33 +1,29 @@
def getCustomer(customerID): class Customer:
customer = getCustomers() def __init__(self, c="",f="",l=""):
return customer[customerID] self.customerID = c
self.firstName = f
def getCustomers(): self.lastName = l
customers = { def fullName(self):
"a": Customer("a","James", "Baker"), return self.firstName + " " + self.lastName
"b": Customer("b", "Jonathan", "D"),
"c": Customer("c", "Aleem", "Janmohamed"), def getCustomers():
"d": Customer("d", "Ivo", "Galic"), customers = {
"e": Customer("e", "Joel", "Griffiths"), "a": Customer("a","James", "Baker"),
"f": Customer("f", "Michael", "Spinks"), "b": Customer("b", "Jonathan", "D"),
"g": Customer("g", "Victor", "Savkov"), "c": Customer("c", "Aleem", "Janmohamed"),
"h" : Customer("h", "Marcel", "Dempers") "d": Customer("d", "Ivo", "Galic"),
} "e": Customer("e", "Joel", "Griffiths"),
"f": Customer("f", "Michael", "Spinks"),
return customers "g": Customer("g", "Victor", "Savkov"),
"h" : Customer("h", "Marcel", "Dempers")
class Customer: }
def __init__(self, c="", f="", l=""): return customers
self.customerID = c
self.firstName = f def getCustomer(customerID):
self.lastName = l customer = getCustomers()
def fullName(self): return customer[customerID]
return self.firstName + " " + self.lastName
customers = getCustomers() customers = getCustomers()
for customerID in customers: for customerID in customers:
print(customers[customerID].fullName()) print(customers[customerID].fullName())