-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclass.py
More file actions
29 lines (24 loc) · 768 Bytes
/
class.py
File metadata and controls
29 lines (24 loc) · 768 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
class TrainingGroup:
# class members
date = ''
participants = []
# class methods
def __init__(self, date, participants):
self.date = date
self.participants = participants
def __str__(self):
return '{0} participants on {1}'.format(len(self.participants), self.date)
def kick_member(self, idiot):
new_members = []
for member in self.participants:
if idiot != member:
new_members.append(member)
else:
print('kicking {0}'.format(idiot))
self.participants = new_members
group = TrainingGroup('2015-08-10', ['Tom', 'Dick', 'Harry'])
print(group)
print(group.participants)
group.kick_member('Dick')
print(group)
print(group.participants)