-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathch09e02.py
55 lines (48 loc) · 897 Bytes
/
ch09e02.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
52
53
54
# Add doctests here
'''
>>> a_list[3]
42
>>> a_list[6]
'Ni!'
>>> len(a_list)
8
>>> b_list[1:]
['Stills', 'Nash']
>>> group = b_list + c_list
>>> group[-1]
'Young'
>>> 'war' in mystery_list
False
>>> 'peace' in mystery_list
True
>>> 'justice' in mystery_list
True
>>> 'oppression' in mystery_list
False
>>> 'equality' in mystery_list
True
>>> range(a, b, c)
[5, 9, 13, 17]
>>> 13 in junk
True
>>> del junk[4]
>>> junk
[3, 7, 9, 10, 17, 21, 24, 27]
>>> del junk[x:y]
>>> junk
[3, 7, 27]
'''
# Python code begins here
a_list = [0, 1, 2, 42, 4, 5, 'Ni!', 8]
b_list = ['Zero', 'Stills', 'Nash']
c_list = ['Young']
mystery_list = ['peace', 'justice', 'equality']
a = 5
b = 20
c = 4
junk = [3, 7, 9, 10, 13, 17, 21, 24, 27]
x = 2
y = 7
if __name__ == '__main__':
import doctest
doctest.testmod()