Python 3.13.3 (tags/v3.13.3:6280bb5, Apr 8 2025, 14:47:33) [MSC v.1943 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. DreamPie 1.2.1 >>> 'ahoj' 0: 'ahoj' >>> 'ah"oj' 1: 'ah"oj' >>> "ahoj" 2: 'ahoj' >>> "ah'oj" 3: "ah'oj" >>> "ah\"oj" 4: 'ah"oj' >>> 'ah\'oj' 5: "ah'oj" >>> předpis = 'F+F--F+F' >>> for znak in předpis: ... print(znak) F + F - - F + F >>> délka = 30 >>> délka += 3 >>> délka 6: 33 >>> délka = délka + 3 >>> délka 7: 36 >>> xs = 'ABC' >>> xs = xs + 'abc' >>> xs 8: 'ABCabc' >>> xs += '123' >>> xs 9: 'ABCabc123' >>> x Traceback (most recent call last): File "<pyshell#18>", line 1, in <module> x NameError: name 'x' is not defined >>> for x in xs: ... ... 10: Ellipsis >>> x 11: '3' >>> xs 12: 'ABCabc123' >>> for x in xs: ... ... ... if x == '1': ... break 13: Ellipsis >>> x 14: '1' >>> for x in xs: ... print(x) A B C a b c 1 2 3 >>> for x in xs: ... print('>', x) > A > B > C > a > b > c > 1 > 2 > 3 >>> for x in enumerate(xs): ... print('>', x) > (0, 'A') > (1, 'B') > (2, 'C') > (3, 'a') > (4, 'b') > (5, 'c') > (6, '1') > (7, '2') > (8, '3') >>> ys = (2, 'C') >>> ys 15: (2, 'C') >>> ys = 2, 'C' >>> ys 16: (2, 'C') >>> len(ys) 17: 2 >>> ys[0] 18: 2 >>> ys[1] 19: 'C' >>> a, b = ys >>> a 20: 2 >>> b 21: 'C' >>> c, d = 2, 'C' >>> c 22: 2 >>> d 23: 'C' >>> for x in enumerate(xs): ... print('>', x) > (0, 'A') > (1, 'B') > (2, 'C') > (3, 'a') > (4, 'b') > (5, 'c') > (6, '1') > (7, '2') > (8, '3') >>> for i,x in enumerate(xs): ... print('>', x) > A > B > C > a > b > c > 1 > 2 > 3 >>> for i,x in enumerate(xs): ... print('>', i, x) > 0 A > 1 B > 2 C > 3 a > 4 b > 5 c > 6 1 > 7 2 > 8 3 >>> for i,x in enumerate(xs, start=1): ... print('>', i, x) > 1 A > 2 B > 3 C > 4 a > 5 b > 6 c > 7 1 > 8 2 > 9 3 >>> for i,x in enumerate(xs, start=10): ... print('>', i, x) > 10 A > 11 B > 12 C > 13 a > 14 b > 15 c > 16 1 > 17 2 > 18 3 >>> 'a' in 'ahoj' 24: True >>> 'a' in 'Ahoj' 25: False >>> 'a' in ('bac', 123, 'a', [0, 1]) 26: True >>> 'a' in ('bac', 123, 'A', [0, 1]) 27: False >>> 'ho' in 'ahoj' 28: True >>> 'he' in 'ahoj' 29: False >>> ('bac', 123, 'a', [0, 1])[2] 30: 'a' >>> xs = ('bac', 123, 'a', [0, 1]) >>> xs 31: ('bac', 123, 'a', [0, 1]) >>> xs[2] 32: 'a' >>> import random >>> dir(random) 33: ['BPF', 'LOG4', 'NV_MAGICCONST', 'RECIP_BPF', 'Random', 'SG_MAGICCONST', 'SystemRandom', 'TWOPI', '_ONE', '_Sequence', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_accumulate', '_acos', '_bisect', '_ceil', '_cos', '_e', '_exp', '_fabs', '_floor', '_index', '_inst', '_isfinite', '_lgamma', '_log', '_log2', '_os', '_parse_args', '_pi', '_random', '_repeat', '_sha512', '_sin', '_sqrt', '_test', '_test_generator', '_urandom', 'betavariate', 'binomialvariate', 'choice', 'choices', 'expovariate', 'gammavariate', 'gauss', 'getrandbits', 'getstate', 'lognormvariate', 'main', 'normalvariate', 'paretovariate', 'randbytes', 'randint', 'random', 'randrange', 'sample', 'seed', 'setstate', 'shuffle', 'triangular', 'uniform', 'vonmisesvariate', 'weibullvariate'] >>> random.random() 34: 0.2779851248683556 >>> random.random() 35: 0.47718980426951907 >>> random.random() 36: 0.3935815415999956 >>> random.random() 37: 0.9696733379568543 >>> random.random() 38: 0.05599692778360177 >>> random.seed(0) >>> random.random() 39: 0.8444218515250481 >>> random.random() 40: 0.7579544029403025 >>> random.random() 41: 0.420571580830845 >>> random.seed(0) >>> random.random() 42: 0.8444218515250481 >>> random.random() 43: 0.7579544029403025 >>> random.random() 44: 0.420571580830845 >>> random.randint(1, 3) 45: 2 >>> random.randint(1, 3) 46: 3 >>> random.randint(1, 3) 47: 2 >>> random.randint(1, 3) 48: 2 >>> random.randint(1, 3) 49: 2 >>> random.randint(1, 3) 50: 2 >>> random.randint(1, 3) 51: 2 >>> random.randint(1, 3) 52: 3 >>> random.randint(1, 3) 53: 1 >>> xs = [1, 'a', 33, dir, (1, 2), print, 'Ahoj!'] >>> xs 54: [1, 'a', 33, <built-in function dir>, (1, 2), <built-in function print>, 'Ahoj!'] >>> len(xs) 55: 7 >>> for x in xs: ... print(x) 1 a 33 <built-in function dir> (1, 2) <built-in function print> Ahoj! >>> dir(xs) 56: ['__add__', '__class__', '__class_getitem__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getstate__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'] [About 47 more lines. Double-click to unfold] >>> xs[0] 57: 1 >>> xs[1] 58: 'a' >>> xs[-1] 59: 'Ahoj!' >>> xs[6] 60: 'Ahoj!' >>> xs[3:] 61: [<built-in function dir>, (1, 2), <built-in function print>, 'Ahoj!'] >>> xs[:5] 62: [1, 'a', 33, <built-in function dir>, (1, 2)] >>> xs[:] 63: [1, 'a', 33, <built-in function dir>, (1, 2), <built-in function print>, 'Ahoj!'] >>> xs[::2] 64: [1, 33, (1, 2), 'Ahoj!'] >>> xs 65: [1, 'a', 33, <built-in function dir>, (1, 2), <built-in function print>, 'Ahoj!'] >>> xs[::-1] 66: ['Ahoj!', <built-in function print>, (1, 2), <built-in function dir>, 33, 'a', 1] >>> xs 67: [1, 'a', 33, <built-in function dir>, (1, 2), <built-in function print>, 'Ahoj!'] >>> xs.reverse() >>> xs 68: ['Ahoj!', <built-in function print>, (1, 2), <built-in function dir>, 33, 'a', 1] >>> xs[0] 69: 'Ahoj!' >>> xs[-1] 70: 1 >>> xs = [1, 2, 3, 4] >>> xs 71: [1, 2, 3, 4] >>> xs.append('a') >>> xs 72: [1, 2, 3, 4, 'a'] >>> xs.pop() 73: 'a' >>> xs 74: [1, 2, 3, 4] >>> xs = [] >>> xs 75: [] >>> ys = list() >>> ys 76: [] >>> xs.append(1) >>> xs 77: [1] >>> xs.append(2) >>> xs 78: [1, 2] >>> xs.append(3) >>> xs 79: [1, 2, 3] >>> xs.pop() 80: 3 >>> xs 81: [1, 2] >>> xs.pop() 82: 2 >>> xs 83: [1] >>> xs.pop() 84: 1 >>> xs 85: [] >>> xs.pop() Traceback (most recent call last): File "<pyshell#121>", line 1, in <module> xs.pop() ~~~~~~^^ IndexError: pop from empty list >>>