Python 3.11.2 (tags/v3.11.2:878ead1, Feb 7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. DreamPie 1.2.1 >>> import collections >>> dir(collections) 0: ['ChainMap', 'Counter', 'OrderedDict', 'UserDict', 'UserList', 'UserString', '_Link', '_OrderedDictItemsView', '_OrderedDictKeysView', '_OrderedDictValuesView', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '_chain', '_collections_abc', '_count_elements', '_eq', '_iskeyword', '_itemgetter', '_proxy', '_recursive_repr', '_repeat', '_starmap', '_sys', '_tuplegetter', 'abc', 'defaultdict', 'deque', 'namedtuple'] [About 35 more lines. Double-click to unfold] >>> Filmy = collections.namedtuple('Film', 'pořadí, název, rok, režisér') >>> FIlmy Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> FIlmy NameError: name 'FIlmy' is not defined >>> Filmy 1: <class '__main__.Film'> >>> x = Film(1, 'xxx', 2000, 'ABC') Traceback (most recent call last): File "<pyshell#5>", line 1, in <module> x = Film(1, 'xxx', 2000, 'ABC') ^^^^ NameError: name 'Film' is not defined >>> x = Filmy(1, 'xxx', 2000, 'ABC') >>> x 2: Film(pořadí=1, název='xxx', rok=2000, režisér='ABC') >>> type(x) 3: <class '__main__.Film'> >>> dir(x) 4: ['__add__', '__class__', '__class_getitem__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__match_args__', '__module__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', '_asdict', '_field_defaults', '_fields', '_make', '_replace', 'count', 'index', 'název', 'pořadí', 'režisér', 'rok'] [About 46 more lines. Double-click to unfold] >>> x[2] 5: 2000 >>> x[-1] 6: 'ABC' >>> x.režisér 7: 'ABC' >>> xs = range(10) >>> print(xs) range(0, 10) >>> for x in xs: ... print(x) 0 1 2 3 4 5 6 7 8 9 >>> dir(xs) 8: ['__bool__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'count', 'index', 'start', 'step', 'stop'] [About 34 more lines. Double-click to unfold] >>> it = iter(xs) >>> it 9: <range_iterator object at 0x0000029CF8DA84F0> >>> dir(it) 10: ['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__length_hint__', '__lt__', '__ne__', '__new__', '__next__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__'] [About 27 more lines. Double-click to unfold] >>> next(it) 11: 0 >>> next(it) 12: 1 >>> it.__next__() 13: 2 >>> for x in it: ... print(x) 3 4 5 6 7 8 9 >>> for x in it: ... print(x) >>> next(it) Traceback (most recent call last): File "<pyshell#25>", line 1, in <module> next(it) StopIteration >>> 'režisér'.split() 14: ['režisér'] >>> 'režisér'.split()[-1] 15: 'režisér' >>> 'režisér'.split()[1] Traceback (most recent call last): File "<pyshell#28>", line 1, in <module> 'režisér'.split()[1] ~~~~~~~~~~~~~~~~~^^^ IndexError: list index out of range >>> xs = [upper(x) for x in 'abc'] Traceback (most recent call last): File "<pyshell#29>", line 1, in <module> xs = [upper(x) for x in 'abc'] ^^^^^^^^^^^^^^^^^^^^^^^^^ File "<pyshell#29>", line 1, in <listcomp> xs = [upper(x) for x in 'abc'] ^^^^^ NameError: name 'upper' is not defined >>> xs = [x.upper() for x in 'abc'] >>> xs 16: ['A', 'B', 'C'] >>> xs = [1 for x in 'abc'] >>> xs 17: [1, 1, 1] >>> (1 for x in 'abc') 18: <generator object <genexpr> at 0x0000029CF8D02F60> >>> go = (1 for x in 'abc') >>> go 19: <generator object <genexpr> at 0x0000029CF849BB90> >>> dir(go) 20: ['__class__', '__del__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__next__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'close', 'gi_code', 'gi_frame', 'gi_running', 'gi_suspended', 'gi_yieldfrom', 'send', 'throw'] [About 36 more lines. Double-click to unfold] >>> import random >>> random.random() 21: 0.9087240566923888 >>> random.random() 22: 0.07444239709899714 >>> random.random() 23: 0.20967848896881147 >>> random.random() 24: 0.6493410280404563 >>> random.seed(0) >>> random.random() 25: 0.8444218515250481 >>> random.random() 26: 0.7579544029403025 >>> random.random() 27: 0.420571580830845 >>> random.seed(0) >>> random.random() 28: 0.8444218515250481 >>> random.random() 29: 0.7579544029403025 >>> random.random() 30: 0.420571580830845 >>>