Python 3.12.2 (tags/v3.12.2:6abddd9, Feb 6 2024, 21:26:36) [MSC v.1937 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
DreamPie 1.2.1
>>> range(4)
0: range(0, 4)
>>> for i in range(4):
... print(i)
0
1
2
3
>>> for i in range(0, 4):
... print(i)
0
1
2
3
>>> for i in range(2, 4):
... print(i)
2
3
>>> for i in range(2, 6):
... print(i)
2
3
4
5
>>> for i in range(0, 10):
... print(i)
0
1
2
3
4
5
6
7
8
9
>>> for i in range(0, 10, 3):
... print(i)
0
3
6
9
>>> for i in range(0, 10, 4):
... print(i)
0
4
8
>>> 'abrakadabra'
1: 'abrakadabra'
>>> 'abrakadabra'[0]
2: 'a'
>>> 'abrakadabra'[1]
3: 'b'
>>> 'abrakadabra'[4]
4: 'k'
>>> len('abrakadabra')
5: 11
>>> 'abrakadabra'[10]
6: 'a'
>>> 'abrakadabra'[-1]
7: 'a'
>>> 'abrakadabra'[-2]
8: 'r'
>>> 'abrakadabra'[-3]
9: 'b'
>>> 'abrakadabra'[0:11]
10: 'abrakadabra'
>>> 'abrakadabra'[0:10]
11: 'abrakadabr'
>>> 'abrakadabra'[0:-1]
12: 'abrakadabr'
>>> 'abrakadabra'[0:11:3]
13: 'aadr'
>>> for i in 'abcd':
... print(i)
a
b
c
d
>>> for znak in 'abcd':
... print(znak)
a
b
c
d
>>> řetězec = 'abcd'
... for znak in řetězec:
... print(znak)
a
b
c
d
>>> barvy = ['green', 'red', 'yellow', 'blue']
... for barva in barvy:
... print(barva)
green
red
yellow
blue
>>> barvy = ('green', 'red', 'yellow', 'blue')
... for barva in barvy:
... print(barva)
green
red
yellow
blue
>>> barvy = 'green', 'red', 'yellow', 'blue'
... for barva in barvy:
... print(barva)
green
red
yellow
blue
>>> barvy
14: ('green', 'red', 'yellow', 'blue')
>>> číslo = 10
... while číslo > 0:
... print(číslo)
... číslo -= 1
10
9
8
7
6
5
4
3
2
1
>>> x = 3
>>> x
15: 3
>>> x, y = 1, 2
>>> x
16: 1
>>> y
17: 2
>>> (x, y) = (1, 2)
>>> x
18: 1
>>> y
19: 2
>>> x, y = [1, 2]
>>> x
20: 1
>>> y
21: 2
>>> x, y = 'ab'
>>> x
22: 'a'
>>> y
23: 'b'
>>>