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, " "světe!" >>> xs 0: 'Ahoj, světe!' >>> "Ahoj, 'Pavle', jak se máš." 1: "Ahoj, 'Pavle', jak se máš." >>> # "Ahoj, "Pavle", jak se máš." >>> "Ahoj, \"Pavle\", jak se máš." 2: 'Ahoj, "Pavle", jak se máš.' >>> "Ahoj, Pavle,\njak se máš." 3: 'Ahoj, Pavle,\njak se máš.' >>> "Ahoj, Pavle,\\njak se máš." 4: 'Ahoj, Pavle,\\njak se máš.' >>> ys = "Ahoj, Pavle,\njak se máš." >>> zs = "Ahoj, Pavle,\\njak se máš." >>> ys 5: 'Ahoj, Pavle,\njak se máš.' >>> print(ys) Ahoj, Pavle, jak se máš. >>> print(zs) Ahoj, Pavle,\njak se máš. >>> zzs = r"Ahoj, Pavle,\njak se máš." >>> zzs 6: 'Ahoj, Pavle,\\njak se máš.' >>> print(zzs) Ahoj, Pavle,\njak se máš. >>> xs 7: 'Ahoj, světe!' >>> len(xs) 8: 12 >>> xs.__len__() 9: 12 >>> xs[3] 10: 'j' >>> xs[-3] 11: 't' >>> xs[-1] 12: '!' >>> xs[3:] 13: 'j, světe!' >>> xs[:3] 14: 'Aho' >>> xs[3:-2] 15: 'j, svět' >>> xs[::2] 16: 'Ao,sěe' >>> xs[::-2] 17: '!tv jh' >>> xs[::-1] 18: '!etěvs ,johA' >>> 's' in xs 19: True >>> 's' not in xs 20: False >>> 'ahoj' in xs 21: False >>> 'Ahoj' in xs 22: True >>> dir(xs) 23: ['__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'] [About 80 more lines. Double-click to unfold] >>> xs * 3 24: 'Ahoj, světe!Ahoj, světe!Ahoj, světe!' >>> print(' ', 666) 666 >>> print(' '*10, 666) 666 >>> print(' ', 666) 666 >>> 3 * xs 25: 'Ahoj, světe!Ahoj, světe!Ahoj, světe!' >>> xs.__mul__(3) 26: 'Ahoj, světe!Ahoj, světe!Ahoj, světe!' >>> (3).__rmul__(xs) 27: NotImplemented >>> int(3).__rmul__(xs) 28: NotImplemented >>> for x in 'ahoj': ... print(x) a h o j >>> for x in reversed('ahoj'): ... print(x) j o h a >>> for x in sorted('ahoj'): ... print(x) a h j o >>> for x in enumerate('ahoj'): ... print(x) (0, 'a') (1, 'h') (2, 'o') (3, 'j') >>> 'ahoj'[2] 29: 'o' >>> for x in enumerate('ahoj', start=1): ... print(x) (1, 'a') (2, 'h') (3, 'o') (4, 'j') >>> xs 30: 'Ahoj, světe!' >>> xs[0] 31: 'A' >>> xs[0] = 'a' Traceback (most recent call last): File "<pyshell#48>", line 1, in <module> xs[0] = 'a' ~~^^^ TypeError: 'str' object does not support item assignment >>> ys = 'a' + xs[1:] >>> ys 32: 'ahoj, světe!' >>> xs 33: 'Ahoj, světe!' >>> id(xs) 34: 1901860940720 >>> id(ys) 35: 1901895769744 >>> xs = 'a' + xs[1:] >>> xs 36: 'ahoj, světe!' >>> id(xs) 37: 1901895769648 >>> f'XXX: {xs}' 38: 'XXX: ahoj, světe!' >>> f'XXX: {xs * 2}' 39: 'XXX: ahoj, světe!ahoj, světe!' >>> f'XXX: {xs * 2} -- {print}' 40: 'XXX: ahoj, světe!ahoj, světe! -- <built-in function print>' >>> for x in enumerate('ahoj', start=1): ... print(x) (1, 'a') (2, 'h') (3, 'o') (4, 'j') >>> x 41: (4, 'j') >>> '1'.isidentifier() 42: False >>> from locale import atoi, atof >>> atof('-123.4') 43: -123.4 >>> xs = " Hello World, I am here. " >>> xs.split() 44: ['Hello', 'World,', 'I', 'am', 'here.'] >>> for i in range(3): print(1); print('a') 1 a 1 a 1 a >>>