Python 3.13.0 (tags/v3.13.0:60403a5, Oct 7 2024, 09:38:07) [MSC v.1941 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
DreamPie 1.2.1
>>> xs = 'ahoj'
>>> type(xs)
0: <class 'str'>
>>> len(xs)
1: 4
>>> ys = b'ahoj'
>>> xs
2: 'ahoj'
>>> ys
3: b'ahoj'
>>> len(ys)
4: 4
>>> type(ys)
5: <class 'bytes'>
>>> for x in xs:
... print(x)
a
h
o
j
>>> for y in ys:
... print(y)
97
104
111
106
>>> for i in range(128, 256):
... print(chr(i), end=' ')
¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ® ¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ
>>> ord(255)
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
ord(255)
~~~^^^^^
TypeError: ord() expected string of length 1, but int found
>>> chr(255)
6: 'ÿ'
>>> zs = b'\ff'
>>> zs
7: b'\x0cf'
>>> zs = b'\xff'
>>> zs
8: b'\xff'
>>> zs[0]
9: 255
>>> zs = b'\xff\x00'
>>> zs
10: b'\xff\x00'
>>> zs[0]
11: 255
>>> zs[1]
12: 0
>>> len(zs)
13: 2
>>> int('50', 16)
14: 80
>>> chr(int('50', 16))
15: 'P'
>>> chr(int('32', 16))
16: '2'
>>> chr(int('20', 16))
17: ' '
>>> bytes()
18: b''
>>> str()
19: ''
>>> bytes(3)
20: b'\x00\x00\x00'
>>> bytes(0)
21: b''
>>> bytes(1)
22: b'\x00'
>>> bytes(2)
23: b'\x00\x00'
>>> bytes([3])
24: b'\x03'
>>> bytes((3,))
25: b'\x03'
>>> bytes([0, 1, 2, 3, 4, 5])
26: b'\x00\x01\x02\x03\x04\x05'
>>> bytes([0, 1, 2, 3, 4, 5])[-1]
27: 5
>>> range(10)
28: range(0, 10)
>>> list(range(10))
29: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> xs = []
>>> xs.append(11)
>>> xs.append(0)
>>> xs.append(0)
>>> xs
30: [11, 0, 0]
>>> xs = []
>>> xs.extend([11, 0, 0])
>>> xs
31: [11, 0, 0]
>>> 6*256
32: 1536
>>> '1 0 '*4
33: '1 0 1 0 1 0 1 0 '
>>> '1 0 '*4 + '0 1 '*4
34: '1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 '
>>> int('10101010', 2)
35: 170
>>> int('01010101', 2)
36: 85
>>> hex(170)
37: '0xaa'
>>> hex(85)
38: '0x55'
>>> hex(int('10001000', 2))
39: '0x88'
>>> hex(int('01000100', 2))
40: '0x44'
>>> hex(int('00100010', 2))
41: '0x22'
>>> hex(int('00010001', 2))
42: '0x11'
>>>