Балтаев Глеб Иркинович 341 SeeSaw 9443
Jhinww SeeSaw 9715
f1from collections import dequef1from collections import deque
22
3def seesaw(sequence):3def seesaw(sequence):
n4    even_queue = deque()n4    evens = deque()
5    odd_queue = deque()5    odds = deque()
6    for item in sequence:6    for number in sequence:
7        if item % 2 == 0:7        if number % 2 == 0:
8            even_queue.append(item)8            evens.append(number)
9        else:9        else:
t10            odd_queue.append(item)t10            odds.append(number)
11    while even_queue or odd_queue:11    while evens or odds:
12        if even_queue:12        if evens:
13            yield even_queue.popleft()13            yield evens.popleft()
14        if odd_queue:14        if odds:
15            yield odd_queue.popleft()15            yield odds.popleft()
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op