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 >>> 0.2 + 0.2 0: 0.4 >>> 0.2 + 0.2 + 0.2 1: 0.6000000000000001 >>> 0.2 + 0.2 + 0.2 + 0.2 2: 0.8 >>> 0.2 + 0.2 + 0.2 + 0.2 + 0.2 3: 1.0 >>> 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 4: 1.2 >>> 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 5: 1.4 >>> 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 6: 1.5999999999999999 >>> 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 7: 1.7999999999999998 >>> 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 8: 1.9999999999999998 >>> 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 + 0.2 9: 2.1999999999999997 >>> bin(10) 10: '0b1010' >>> oct(10) 11: '0o12' >>> hex(10) 12: '0xa' >>> int() 13: 0 >>> str() 14: '' >>> int('a', 16) 15: 10 >>> int(0xa) 16: 10 >>> int('a', 11) 17: 10 >>> int('b', 11) Traceback (most recent call last): File "<pyshell#18>", line 1, in <module> int('b', 11) ~~~^^^^^^^^^ ValueError: invalid literal for int() with base 11: 'b' >>> int('10', 11) 18: 11 >>> dir(0) 19: ['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__getstate__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'as_integer_ratio', 'bit_count', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'is_integer', 'numerator', 'real', 'to_bytes'] >>> int(2).__add__(3) 20: 5 >>> 2 + 3 21: 5 >>> int(3).__add__(2) 22: 5 >>> int(3).__radd__(2) 23: 5 >>> 3 + 2 24: 5 >>> dir('') 25: ['__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'] >>> 'abc' + '123' 26: 'abc123' >>> 'abc'.__add__('123') 27: 'abc123' >>> x Traceback (most recent call last): File "<pyshell#29>", line 1, in <module> x NameError: name 'x' is not defined >>> x, y = 2, 3 >>> f'{x} x {y}' 28: '2 x 3' >>> f'{x} x {print}' 29: '2 x <built-in function print>' >>> print 30: <built-in function print> >>> f'{x:>2}' 31: ' 2' >>> f'{x}' 32: '2' >>> f'{x:>3}' 33: ' 2' >>> 256 * 16 34: 4096 >>> import math >>> math.inf 35: inf >>> 1_000_000 > math.inf 36: False >>> 1.30 + 1.20 37: 2.5 >>> z Traceback (most recent call last): File "<pyshell#42>", line 1, in <module> z NameError: name 'z' is not defined >>> for z in 'abcd': ... print(z) a b c d >>> z 38: 'd' >>> for z in range(4): ... print(z) 0 1 2 3 >>> range() Traceback (most recent call last): File "<pyshell#46>", line 1, in <module> range() ~~~~~^^ TypeError: range expected at least 1 argument, got 0 >>> range(4) 39: range(0, 4) >>> dir(range(4)) 40: ['__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'] >>> it = iter(range(4)) >>> it 41: <range_iterator object at 0x000001F5058360F0> >>> dir(it) 42: ['__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__'] >>> next(it) 43: 0 >>> next(it) 44: 1 >>> next(it) 45: 2 >>> next(it) 46: 3 >>> next(it) Traceback (most recent call last): File "<pyshell#56>", line 1, in <module> next(it) ~~~~^^^^ StopIteration >>> it = iter(range(4)) >>> next(it) 47: 0 >>> next(it) 48: 1 >>> for i in it: ... print(i) 2 3 >>> for znak in 'abc': ... print(znak, end='|') a|b|c| >>> list(range(2, 101)) 49: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] [About 98 more lines. Double-click to unfold] >>> range(2, 101) 50: range(2, 101) >>> ' '.join(str(x) for x in range(2, 101)) 51: ('2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 ' '30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 ' '55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 ' '80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100') >>> ' '.join(str(x) for x in range(2, 101, 5)) 52: '2 7 12 17 22 27 32 37 42 47 52 57 62 67 72 77 82 87 92 97' >>> ' '.join(str(x) for x in range(2, 101, -5)) 53: '' >>> ' '.join(str(x) for x in range(101, 2, -5)) 54: '101 96 91 86 81 76 71 66 61 56 51 46 41 36 31 26 21 16 11 6' >>> ' '.join(str(x) for x in range(100, 1, -5)) 55: '100 95 90 85 80 75 70 65 60 55 50 45 40 35 30 25 20 15 10 5' >>> ' '.join(str(x) for x in range(100, 2, -5)) 56: '100 95 90 85 80 75 70 65 60 55 50 45 40 35 30 25 20 15 10 5' >>> ' '.join(str(x) for x in range(100, 2)) 57: '' >>> ' '.join(str(x) for x in range(100, 2, -1)) 58: ('100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 ' '75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 ' '50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 ' '25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3') >>> xs = 'abcd' >>> xs[2] 59: 'c' >>> xs[2:] 60: 'cd' >>> xs[:2] 61: 'ab' >>> xs[::-1] 62: 'dcba' >>>