-
Notifications
You must be signed in to change notification settings - Fork 0
/
probyQueue.py
62 lines (37 loc) · 1.04 KB
/
probyQueue.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
55
56
57
58
59
60
61
62
import queue
import collections
from collections import deque
q = queue.Queue()
for i in range(5):
q.put(i)
while not q.empty():
print(q.get())
q = collections.deque()
for i in range(5):
q.append("{*}")
print(", ".join(q))
q = collections.deque()
for i in range(5):
q.append(i)
deque(range(5))
print(", ".join(map(lambda x: str(x), q)))
print(", ".join([str(i) for i in q]))
print(", ".join(str(i) for i in q))
print(str(4))
print(q[0], q[-1])
print(all(el >= 0 for el in q))
print(", ".join(map(lambda x: str(x), q)))
q.popleft()
print(", ".join(map(lambda x: str(x), q)))
#----------------------------------------------
for i, v in enumerate(['tic', 'tac', 'toe']):
print(i, v)
for v in ['tic', 'tac', 'toe']:
print(v)
#----------------------------------------------
import numpy as np
q = np.array(range(5)) * .333333
print(", ".join("{:.2f}".format(i) for i in q))
#----------------------------------------------
sum([x for x in range(10)])
sum(x for x in range(10))