Python 3.13.6 (tags/v3.13.6:4e66535, Aug 6 2025, 14:36:00) [MSC v.1944 64 bit (AMD64)] on win32 Enter "help" below or click "Help" above for more information. i = 10 i 10 type(i) i.bit_count() 2 i.upper() Traceback (most recent call last): File "", line 1, in i.upper() AttributeError: 'int' object has no attribute 'upper' id(i) 140718284174536 dir(i) ['__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'] i = 99 id(i) 140718284177384 i =84730473590475903475043705734790473570347509 id(i) 2004248670832 import sys sys.getsizeof(i) 44 i=847983479873 sys.getsizeof(i) 32 i =84375984378957349857984237598897598347857239845798234759834795823749857342985729384579823475983475983475983475983475893479857349857349857348957938247598347598342759834759834759834275983475983427598345793845897 i 84375984378957349857984237598897598347857239845798234759834795823749857342985729384579823475983475983475983475983475893479857349857349857348957938247598347598342759834759834759834275983475983427598345793845897 sys.getsizeof(i) 120 s = 'hello, world' type(s) dir(s) ['__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'] l = x.split() Traceback (most recent call last): File "", line 1, in l = x.split() NameError: name 'x' is not defined l = s.split() l ['hello,', 'world'] l = x.split('') Traceback (most recent call last): File "", line 1, in l = x.split('') NameError: name 'x' is not defined l = s.split('') Traceback (most recent call last): File "", line 1, in l = s.split('') ValueError: empty separator l = s.split('l') l ['he', '', 'o, wor', 'd'] s 'hello, world' list(s) ['h', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd'] l1 = [] l1 [] id(li) Traceback (most recent call last): File "", line 1, in id(li) NameError: name 'li' is not defined. Did you mean: 'i'? id(l1) 2004204828544 l2 = ['cat', 123, 'dog', 4560 l2 SyntaxError: '[' was never closed l2 = ['cat', 123, 'dog', 456] l2 ['cat', 123, 'dog', 456] l3 = [1,2,1,2,'dog'] l3 [1, 2, 1, 2, 'dog'] l[0] 'he' l3[0] 1 l3[1] 2 l3[4] 'dog' s 'hello, world' s[3] 'l' s[7] 'w' s[10] 'l' s[12] Traceback (most recent call last): File "", line 1, in s[12] IndexError: string index out of range mixed_set = {42, "Hello", 3.14, True, None} print(mixed_set) {None, True, 'Hello', 3.14, 42} set1 = {1,2,1,2,'dog'} set1 {1, 2, 'dog'} set1[0] Traceback (most recent call last): File "", line 1, in set1[0] TypeError: 'set' object is not subscriptable dir(set_1) Traceback (most recent call last): File "", line 1, in dir(set_1) NameError: name 'set_1' is not defined. Did you mean: 'set1'? dir(set1) ['__and__', '__class__', '__class_getitem__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__iand__', '__init__', '__init_subclass__', '__ior__', '__isub__', '__iter__', '__ixor__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'add', 'clear', 'copy', 'difference', 'difference_update', 'discard', 'intersection', 'intersection_update', 'isdisjoint', 'issubset', 'issuperset', 'pop', 'remove', 'symmetric_difference', 'symmetric_difference_update', 'union', 'update'] set1.union({2,3}) {1, 2, 3, 'dog'} country_capitals = { "Germany": "Berlin", "Canada": "Ottawa", "England": "London" } country_capitals {'Germany': 'Berlin', 'Canada': 'Ottawa', 'England': 'London'} print(f"The capital of Canada is {country_capitals['Canada']}") The capital of Canada is Ottawa print(f"The capital of Canada is country_capitals['Canada']: {country_capitals['Canada']}") The capital of Canada is country_capitals['Canada']: Ottawa dir(country_capitals) ... ['__class__', '__class_getitem__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__ior__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__ror__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values'] >>> country_capitals.__sizeof__ ... >>> country_capitals.size() ... Traceback (most recent call last): File "", line 1, in country_capitals.size() AttributeError: 'dict' object has no attribute 'size' >>> country_capitals.keys() ... dict_keys(['Germany', 'Canada', 'England']) >>> country_capitals ... {'Germany': 'Berlin', 'Canada': 'Ottawa', 'England': 'London'} >>> country_capitals.values() ... dict_values(['Berlin', 'Ottawa', 'London'])