-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddress.py
51 lines (37 loc) · 1.43 KB
/
address.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# noinspection PyUnreachableCode
class Address:
def __init__(self, city: str, street: str, house_num: int, po_num:int = None):
self.city = city
self.street = street
self.house_num = house_num
self.po_num: "str(int)" = po_num
def __str__(self):
if self.po_num is None:
return f"city: {self.city}, street: {self.street}, house number: {self.house_num}"
else:
return f"city: {self.city}, street: {self.street}, house number: {self.house_num}, po box number: {self.po_num}"
def __repr__(self):
if self.po_num is None:
return f"city: {self.city}, street: {self.street}, house number: {self.house_num}"
else:
return f"city: {self.city}, street: {self.street}, house number: {self.house_num}, po box number: {self.po_num}"
#getters
def get_city(self):
return self.city
def get_street(self):
return self.street
def get_house_num(self):
return self.house_num
def get_po_num(self):
return self.po_num
#setters
def set_house_num(self, new_house_num):
self.house_num = new_house_num
def set_street(self, new_street):
self.street = new_street
def set_city(self, new_city):
self.city = new_city
def set_po_num(self, new_po_num):
self.po_num = new_po_num
# address = Address("raanana", "hamachtarot", 20, 4464624)
# print(address.__str__())