-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrodent.py
36 lines (26 loc) · 931 Bytes
/
rodent.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
#tag ID: A8025 (area and number, string)
#size (oz)
#sightings per month
#is_large (large means >5 oz)
#is_small (small means <3 oz)
#capture(month) number of times it's been sighted this month
class Rodent:
def __init__(self, tag_id, size ):
self.tag_id = tag_id
self.size = size
self.sightings_per_month = {}
def is_large(self):
# return True if size is > 5oz
return (self.size > 5)
def is_small(self):
# return True if size is < 3oz
return (self.size < 3)
def plot(self):
# return the letter of the plot at which
# this rodent was first captured
return self.tag_id[0]
def capture(self, month):
# we captured this rodent once in this month
if month not in self.sightings_per_month:
self.sightings_per_month[month] = 0
self.sightings_per_month[month] += 1