Волков-Рарог Артём Александрович, 516 группа PushPull 9376
Хуторной Дмитрий, 516 PushPull 9447
t1class Pushpull:t1class Pushpull:
22
3    def __init__(self, n=0):3    def __init__(self, n=0):
4        Pushpull.pos = n4        Pushpull.pos = n
55
6    def push(self, n=1):6    def push(self, n=1):
7        Pushpull.pos += n7        Pushpull.pos += n
88
9    def pull(self, n=1):9    def pull(self, n=1):
10        Pushpull.pos -= n10        Pushpull.pos -= n
1111
12    def __iter__(self):12    def __iter__(self):
13        if Pushpull.pos < 0:13        if Pushpull.pos < 0:
14            return iter(range(0, Pushpull.pos, -1))14            return iter(range(0, Pushpull.pos, -1))
15        else:15        else:
16            return iter(range(Pushpull.pos))16            return iter(range(Pushpull.pos))
1717
18    def __str__(self):18    def __str__(self):
19        if Pushpull.pos < 0:19        if Pushpull.pos < 0:
20            return f'<{abs(Pushpull.pos)}<'20            return f'<{abs(Pushpull.pos)}<'
21        elif Pushpull.pos > 0:21        elif Pushpull.pos > 0:
22            return f'>{Pushpull.pos}>'22            return f'>{Pushpull.pos}>'
23        else:23        else:
24            return '<0>'24            return '<0>'
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op