Guruh talabasi Qayimov Jamshidning
Download 0.66 Mb.
|
315-18 1-lab
315-18 guruh talabasi Qayimov Jamshidning Dasturlash uslublari va piramidalari fanidan class Card: """PLastik karta ma'lumotlari""" def __init__(self, holder, number, expire, balance=0): self.holder = holder self.number = number self.expire = expire self.balance = balance
return self.balance def set_balance(self, balance): self.balance += balance return self.balance
return f"Holder: {self.holder}\nCard number: {self.number}\nExpire date: {self.expire}\nBalance: {self.balance}" class Wallet: """Elektron hamyon obyekt generatori""" def __init__(self, full_name, phone, card): self.full_name = full_name self.phone = phone self.card = card def transfer(self, card, amount): if amount <= self.card.get_balance(): card.set_balance(amount) return "Money transfered" else: return "Money not enogh to transfer" def check_balance(self): return self.card.get_balance() def pay_for_service(self, service, amount): # todo do some checking and pay self.card.set_balance(-amount) return f"{amount} $ payed for service {service}"
return [ "2.10.2020: -200,000 $", "9.10.2020: 310,600 $", "19.10.2020: 11,045 $", "29.10.2020: -1,072 $", ]
print(m.get_info()) w=Wallet('Qayimov Jamshid',777,'100$') print(w.pay_for_service('Amazon','100$')) Download 0.66 Mb. Do'stlaringiz bilan baham: |
ma'muriyatiga murojaat qiling