-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
30 lines (21 loc) · 765 Bytes
/
example.py
File metadata and controls
30 lines (21 loc) · 765 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
28
29
30
# A very simple class modelling coffee beans
class CoffeeBean:
def __init__(self, origin, country, tasting_notes):
self._origin = origin
self._country = country
self._tasting_notes = tasting_notes
def origin(self):
return self._origin
def country(self):
return self._country
def tasting_notes(self):
return self._tasting_notes
def __str__(self):
return "{origin} ({country}): \n* {tasting_notes}".format(
origin=self.origin(),
country=self.country(),
tasting_notes='\n* '.join(self.tasting_notes()))
bean = CoffeeBean("Chumeca La Trinidad",
"Costa Rica",
['caramel', 'chocolate', 'berry fruit'])
print(bean)