Python – String interning
Python - Notes (Menu principal) Toutes les chaines de caractères sont stockées à des adresses mémoires différentes, sauf si elles s'apparentent à une variable : minuscules, underscores et chiffres. a…
Python - Notes (Menu principal) Toutes les chaines de caractères sont stockées à des adresses mémoires différentes, sauf si elles s'apparentent à une variable : minuscules, underscores et chiffres. a…
Python - Notes (Menu principal) my_list = [1, 2, 3] print(my_list) print(hex(id(my_list))) [1, 2, 3] 0x5e020c8 my_list.append(4) print(my_list) print(hex(id(my_list))) [1, 2, 3, 4] 0x5e020c8 my_list_1 = [1, 2, 3] print(my_list_1)…
Python - Notes (Menu principal) class Rectangle: def __init__(self, width, height): self.width = width self.height = height def area(self): return self.width * self.height def perimeter(self): return 2 * (self.width +…
Python - Notes (Menu principal) a = 10 b = 1 try: a / b except ZeroDivisionError: print('division by 0') finally: print('this always executes') this always executes a = 10…
Python - Notes (Menu principal) def mystery_combine(a: str, b: str, times: int) -> str: return (a + b) * times a est de type strb est de type strtimes est…
Python - Notes (Menu principal) a = 5 if a < 10: print('a < 10') else: print('a >= 10') a < 10 a = 5 res = 'a < 10'…
Python - Notes (Menu principal) a = [1, 2, 3] a = [1, # comment 2, # comment 3] # comment a = (1, 2, 3) a = {1, 2,…
Python - Multi-line Statements Python - Ternary Operator Python - Type Annotations Python - Try Except Finally Python - repr VS str Python - Object Mutability Python - String Interning
Markdown Cells Text can be added to Jupyter Notebooks using Markdown cells. You can change the cell type to Markdown by using the Cell menu, the toolbar, or the key…
Passer du mode commande au mode édition : EnterClic gauche sur la cellule Passer du mode édition au mode commande : EscapeCtrl + mClic gauche en dehors de la cellule…