Python 3.14.3 (tags/v3.14.3:323c59a, Feb 3 2026, 16:04:56) [MSC v.1944 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
DreamPie 1.2.1
>>> for znak in "Ahoj!":
... print(znak)
A
h
o
j
!
>>> for znak in enumerate("Ahoj!"):
... print(znak)
(0, 'A')
(1, 'h')
(2, 'o')
(3, 'j')
(4, '!')
>>> for i in range(len("Ahoj!")):
... print(znak[i])
4
!
Traceback (most recent call last):
File "<pyshell#2>", line 2, in <module>
print(znak[i])
~~~~^^^
IndexError: tuple index out of range
>>> for i in range(len("Ahoj!")):
... print(i)
0
1
2
3
4
>>> "Ahoj!"[0]
0: 'A'
>>> "Ahoj!"[4]
1: '!'
>>> i
2: 4
>>> class T:
... i = 'Baf!'
>>> T.i
3: 'Baf!'
>>> i
4: 4
>>> xs = 'Ahoj!'
>>> [znak for znak in xs]
5: ['A', 'h', 'o', 'j', '!']
>>> [ord(znak) for znak in xs]
6: [65, 104, 111, 106, 33]
>>> [(znak, ord(znak)) for znak in xs]
7: [('A', 65), ('h', 104), ('o', 111), ('j', 106), ('!', 33)]
>>> ns = 'A', 65
>>> ns
8: ('A', 65)
>>> type(ns)
9: <class 'tuple'>
>>> ns[0]
10: 'A'
>>> ns[0] = 'B'
Traceback (most recent call last):
File "<pyshell#18>", line 1, in <module>
ns[0] = 'B'
~~^^^
TypeError: 'tuple' object does not support item assignment
>>> ns = ['A'], 65
>>> ns
11: (['A'], 65)
>>> type(ns)
12: <class 'tuple'>
>>> ns[0]
13: ['A']
>>> ns[0] = 'B'
Traceback (most recent call last):
File "<pyshell#23>", line 1, in <module>
ns[0] = 'B'
~~^^^
TypeError: 'tuple' object does not support item assignment
>>> ns[0][0] = 'B'
>>> ns
14: (['B'], 65)
>>> ns = 'A', 65
>>> ns
15: ('A', 65)
>>> hash(ns)
16: -8344888113026024543
>>> ns = ['A'], 65
>>> hash(ns)
Traceback (most recent call last):
File "<pyshell#30>", line 1, in <module>
hash(ns)
~~~~^^^^
TypeError: unhashable type: 'list'
>>> for x in 'ahoj':
... print(x)
a
h
o
j
>>> for x in b'ahoj':
... print(x)
97
104
111
106
>>> chr(97)
17: 'a'
>>> for x in zip('ABC', 'abc'):
... print(x)
('A', 'a')
('B', 'b')
('C', 'c')
>>> for x in zip('ABCD', 'abc'):
... print(x)
('A', 'a')
('B', 'b')
('C', 'c')
>>> def fn():
... '''dokumentace'''
... ...
>>> fn
18: <function fn at 0x000001509A9DF110>
>>> fn()
>>> print(fn())
None
>>> dir(fn)
19: ['__annotate__',
'__annotations__',
'__builtins__',
'__call__',
'__class__',
'__closure__',
'__code__',
'__defaults__',
'__delattr__',
'__dict__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__get__',
'__getattribute__',
'__getstate__',
'__globals__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__kwdefaults__',
'__le__',
'__lt__',
'__module__',
'__name__',
'__ne__',
'__new__',
'__qualname__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'__type_params__']
[About 38 more lines. Double-click to unfold]
>>> fn.__doc__
20: 'dokumentace'
>>> fn.__annotations__
21: {}
>>> def fn() -> int:
... '''dokumentace'''
... ...
>>> fn.__annotations__
22: {'return': <class 'int'>}
>>> def fn() -> ('Baf!', int):
... '''dokumentace'''
... ...
>>> fn.__annotations__
23: {'return': ('Baf!', <class 'int'>)}
>>> def fn(p1: int, p2: float, p3: str) -> ('Baf!', int):
... '''dokumentace'''
... ...
>>> fn.__annotations__
24: {'p1': <class 'int'>,
'p2': <class 'float'>,
'p3': <class 'str'>,
'return': ('Baf!', <class 'int'>)}
>>> def fn(p1: int, p2: float, p3: str) -> list(int):
... '''dokumentace'''
... ...
>>> fn.__annotations__
Traceback (most recent call last):
File "<pyshell#50>", line 1, in <module>
fn.__annotations__
File "<pyshell#49>", line 1, in __annotate__
def fn(p1: int, p2: float, p3: str) -> list(int):
~~~~^^^^^
TypeError: 'type' object is not iterable
>>> def fn():
... pass
>>> def fn():
... ...
>>> ...
25: Ellipsis
>>> xs
26: 'Ahoj!'
>>> len(xs)
27: 5
>>> xs[0]
28: 'A'
>>> xs[4]
29: '!'
>>> xs[3:]
30: 'j!'
>>> xs[:3]
31: 'Aho'
>>> xs[:3] + xs[3:]
32: 'Ahoj!'
>>> xs[::2]
33: 'Ao!'
>>> xs[::3]
34: 'Aj'
>>> xs[2::2]
35: 'o!'
>>> range()
Traceback (most recent call last):
File "<pyshell#64>", line 1, in <module>
range()
~~~~~^^
TypeError: range expected at least 1 argument, got 0
>>> range(3)
36: range(0, 3)
>>> list(range(0, 3))
37: [0, 1, 2]
>>> list(range(2, 7))
38: [2, 3, 4, 5, 6]
>>> list(range(2, 7, 2))
39: [2, 4, 6]
>>> xs
40: 'Ahoj!'
>>> id(xs)
41: 1445702662208
>>> id(xs[:])
42: 1445702662208
>>> ys = xs[:]
>>> id(xs)
43: 1445702662208
>>> id(ys)
44: 1445702662208
>>> set('abrakadabra')
45: {'d', 'k', 'b', 'r', 'a'}
>>> s = set('abrakadabra')
>>> type(s)
46: <class 'set'>
>>> hash(s)
Traceback (most recent call last):
File "<pyshell#78>", line 1, in <module>
hash(s)
~~~~^^^
TypeError: unhashable type: 'set'
>>> hash(frozenset(s))
47: -1669035543744162720
>>> ds = {
... 1: 333,
... 'ahoj': 555,
... (1, 'baf'): print,
... }
>>> ds
48: {1: 333, 'ahoj': 555, (1, 'baf'): <built-in function print>}
>>> type(ds)
49: <class 'dict'>
>>> for x in s:
... print(x)
d
k
b
r
a
>>> s
50: {'d', 'k', 'b', 'r', 'a'}
>>> for x in enumerate(s):
... print(x)
(0, 'd')
(1, 'k')
(2, 'b')
(3, 'r')
(4, 'a')
>>> for x in sorted(s):
... print(x)
a
b
d
k
r
>>> for x in reversed(s):
... print(x)
Traceback (most recent call last):
File "<pyshell#87>", line 1, in <module>
for x in reversed(s):
~~~~~~~~^^^
TypeError: 'set' object is not reversible
>>> ds
51: {1: 333, 'ahoj': 555, (1, 'baf'): <built-in function print>}
>>> for x in ds:
... print(x)
1
ahoj
(1, 'baf')
>>> for x in ds.keys():
... print(x)
1
ahoj
(1, 'baf')
>>> for x in ds.values():
... print(x)
333
555
<built-in function print>
>>> for x in ds.items():
... print(x)
(1, 333)
('ahoj', 555)
((1, 'baf'), <built-in function print>)
>>> for k,v in ds.items():
... print(k, v)
1 333
ahoj 555
(1, 'baf') <built-in function print>
>>> for k,v in ds.items():
... print(f'{k}\t{v}')
1 333
ahoj 555
(1, 'baf') <built-in function print>
>>> 2**8
52: 256
>>> 4 / 2
53: 2.0
>>> 4 // 2
54: 2
>>> 5 / 2
55: 2.5
>>> 5 // 2
56: 2
>>> 5 % 2
57: 1
>>> ds
58: {1: 333, 'ahoj': 555, (1, 'baf'): <built-in function print>}
>>> 'ahoj' in ds
59: True
>>> ds['ahoj']
60: 555
>>> 2 in ds
61: False
>>> ds[2]
Traceback (most recent call last):
File "<pyshell#105>", line 1, in <module>
ds[2]
~~^^^
KeyError: 2
>>> ds.get('ahoj')
62: 555
>>> ds.get(2)
>>> print(ds.get(2))
None
>>> ds.get(2, '000')
63: '000'
>>> xs
64: 'Ahoj!'
>>> 'a' in xs
65: False
>>> 'A' in xs
66: True
>>> 'Ah' in xs
67: True
>>> 'Ah' not in xs
68: False
>>> 'AH' in xs
69: False
>>> 'AH' not in xs
70: True
>>> 1, 2 == 3, 4
71: (1, False, 4)
>>> (1, 2) == (3, 4)
72: False
>>> for x in range(3): print(x)
0
1
2
>>> for x in range(3): print(x); print('Baf!')
0
Baf!
1
Baf!
2
Baf!
>>> for x in range(3):
... print(x)
... print('Baf!')
0
Baf!
1
Baf!
2
Baf!
>>> 3 and ''
73: ''
>>> 3 and 'a'
74: 'a'
>>> 0 and 'a'
75: 0
>>> 3 or ''
76: 3
>>> 0 or ''
77: ''
>>> 0 or 'a'
78: 'a'
>>> True + True
79: 2
>>> False + True
80: 1
>>> a = [1]
>>> b = [1]
>>> a == b
81: True
>>> a is b
82: False
>>> dir('')
83: ['__add__',
'__class__',
'__contains__',
'__delattr__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getitem__',
'__getnewargs__',
'__getstate__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__iter__',
'__le__',
'__len__',
'__lt__',
'__mod__',
'__mul__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__rmod__',
'__rmul__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'capitalize',
'casefold',
'center',
'count',
'encode',
'endswith',
'expandtabs',
'find',
'format',
'format_map',
'index',
'isalnum',
'isalpha',
'isascii',
'isdecimal',
'isdigit',
'isidentifier',
'islower',
'isnumeric',
'isprintable',
'isspace',
'istitle',
'isupper',
'join',
'ljust',
'lower',
'lstrip',
'maketrans',
'partition',
'removeprefix',
'removesuffix',
'replace',
'rfind',
'rindex',
'rjust',
'rpartition',
'rsplit',
'rstrip',
'split',
'splitlines',
'startswith',
'strip',
'swapcase',
'title',
'translate',
'upper',
'zfill']
>>> a, b, c = 'abc'
>>> a
84: 'a'
>>> b
85: 'b'
>>> c
86: 'c'
>>> a, b = 'abc'
Traceback (most recent call last):
File "<pyshell#139>", line 1, in <module>
a, b = 'abc'
^^^^
ValueError: too many values to unpack (expected 2)
>>> a, *b = 'abc'
>>> a
87: 'a'
>>> b
88: ['b', 'c']
>>> *a, b = 'abc'
>>> a
89: ['a', 'b']
>>> b
90: 'c'
>>> a, *_ = 'abc'
>>> a
91: 'a'
>>> _
92: 'a'
>>> _2
Traceback (most recent call last):
File "<pyshell#149>", line 1, in <module>
_2
NameError: name '_2' is not defined
>>> _1
Traceback (most recent call last):
File "<pyshell#150>", line 1, in <module>
_1
NameError: name '_1' is not defined
>>> j
Traceback (most recent call last):
File "<pyshell#151>", line 1, in <module>
j
NameError: name 'j' is not defined
>>> for j in 'abc':
... ...
93: Ellipsis
>>> j
94: 'c'
>>> for j in 'abc':
... ...
... del j
95: Ellipsis
>>> j
Traceback (most recent call last):
File "<pyshell#155>", line 1, in <module>
j
NameError: name 'j' is not defined
>>> xs = ['a', 'h', 'o', 'j']
>>> ys = xs
>>> id(xs)
96: 1445703627264
>>> id(ys)
97: 1445703627264
>>> xs[0] = 'A'
>>> xs
98: ['A', 'h', 'o', 'j']
>>> ys
99: ['A', 'h', 'o', 'j']
>>>