forked from psounis/python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercise10.py
More file actions
27 lines (22 loc) · 851 Bytes
/
Copy pathexercise10.py
File metadata and controls
27 lines (22 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class Person:
def __init__(self, full_name, age, id_number):
self.full_name = full_name
self.age = age
self.id_number = id_number
class Account:
def __init__(self, number, owner, amount):
self.number = number
self.owner = owner
self.amount = amount
def transfer_to(self, account, amount):
if amount <= self.amount:
self.amount -= amount
account.amount += amount
print(self.owner.full_name + " transfered " + str(amount) + " to " + account.owner.full_name)
else:
print("Not enough credit!")
p1 = Person("Bob Hope", "dead", "13219398")
p2 = Person("Donald Trump", 75, "02139484")
a1 = Account("132489480328", p1, 123878.23)
a2 = Account("213094809328", p2, 12388902993.99)
a1.transfer_to(a2,100000)