This README is designed to explain the Python concepts encountered in each exercise. It clarifies common challenges for developers transitioning from C or other languages to Python.
- 
List (
ft_list)- Definition: An ordered, mutable collection of items.
 - Syntax: 
ft_list = ["Hello", "World!"] - Key Properties:
- Supports duplicate elements.
 - Elements can be added, removed, or modified.
 
 - Accessing Items: Index-based. Example: 
ft_list[0]returns"Hello". - Common Use Case: Storing a collection of related items in order.
 
 - 
Tuple (
ft_tuple)- Definition: An ordered, immutable collection of items.
 - Syntax: 
ft_tuple = ("Hello", "France!") - Key Properties:
- Cannot be changed after creation.
 - Supports indexing like lists.
 
 - Accessing Items: Example: 
ft_tuple[1]returns"France!". - Common Use Case: Fixed sets of related data that shouldn't change (e.g., coordinates).
 
 - 
Set (
ft_set)- Definition: An unordered collection of unique items.
 - Syntax: 
ft_set = {"Hello", "Paris!"} - Key Properties:
- Automatically removes duplicates.
 - Does not support indexing (items have no specific order).
 
 - Common Use Case: Removing duplicates or performing set operations like union or intersection.
 
 - 
Dictionary (
ft_dict)- Definition: A collection of key-value pairs.
 - Syntax: 
ft_dict = {"Hello": "42Paris!"} - Key Properties:
- Keys must be unique.
 - Values can be any type.
 
 - Accessing Items: Example: 
ft_dict["Hello"]returns"42Paris!". - Common Use Case: Storing relationships or mappings between keys and values.
 
 
- 
What is an f-string?
- Syntax: 
f"Your text {expression}" - Allows embedding expressions inside strings, evaluated at runtime.
 - Example:
timestamp = 1666355857.3622 print(f"Seconds since January 1, 1970: {timestamp:.4f}")
{timestamp:.4f}formats the value to 4 decimal places.{timestamp:.2e}formats the value in scientific notation.
 
 - Syntax: 
 - 
What does
%bmean?- Used with the 
strftime()method for formatting dates. %b: Abbreviated month name (e.g., "Oct" for October).- Example:
from datetime import datetime print(datetime.now().strftime("%b %d %Y")) # Outputs: Oct 21 2022
 - Other format codes:
%d: Day of the month.%Y: Full year.
 
 - Used with the 
 
- 
Understanding
type()- The 
type()function returns the type of an object. - Example:
obj = [1, 2, 3] print(type(obj)) # Outputs: <class 'list'>
 
 - The 
 - 
What does
.__name__do?type(obj).__name__extracts the name of the type as a string (e.g., "list", "str").- Example:
obj = [1, 2, 3] print(type(obj).__name__) # Outputs: list
 
 - 
What is
__name__?__name__is a special variable in Python that indicates whether a script is being run directly or imported as a module.- Syntax:
if __name__ == "__main__": print("This script is being run directly!")
 - Meaning:
- When the script is run directly, 
__name__is set to"__main__". - When the script is imported as a module, 
__name__is set to the module's name. 
 - When the script is run directly, 
 
Why use it?
- To define behavior that only executes when the script is run directly, not when imported.
 
 
- 
What is
tryandexcept?- A way to handle errors gracefully in Python without crashing the program.
 - Syntax:
try: # Code that might raise an exception except ExceptionType: # Handle the exception
 
 - 
Why use
try-exceptin Ex03?- The function checks if the type of an object can be determined.
 - If an error occurs (e.g., invalid input), it prevents the program from crashing by catching the exception.
 - Example:
try: print(f"{obj}: {type(obj)}") return 0 except Exception: print("Type not Found") return 1
 
 - 
Why don't we use
.__name__here?- In Ex03, the goal is to print both the object and its type for debugging purposes.
 - Using 
type(obj)provides more detailed information (e.g.,<class 'list'>), which can be helpful for identifying issues. - If simplicity is preferred, you could still use 
type(obj).__name__for a cleaner output. 
 
- 
What is
raise?raiseis used to explicitly raise an exception in Python.- Example:
if len(sys.argv) != 2: raise AssertionError("More than one argument is provided")
 
 - 
Why use
raise?- To signal that an error has occurred and stop execution immediately.
 - Key Differences:
raiseis for explicitly triggering exceptions.try-exceptis for catching and handling exceptions.
 
 - 
Common Use Cases:
- 
Validating inputs:
if not isinstance(arg, int): raise ValueError("Expected an integer")
 - 
Stopping execution when a critical error occurs:
raise RuntimeError("Critical error occurred!")
 
 - 
 
docstring and flake8
generator and iterator (yield), create a package, __
ex05 how main works ex06 what filter does. what is a generator and list comprehension et lambda ex07 join et rstrip ex08 '\r' and sys.stdout.write doesnt have '\n' compare to print, iterateur et yield ex09 how to create a package (faire ma license et verif toml)
day 02 img and numpy and plt
day 03 csv and panda and plt
day 04 object (init vs cls)
day 05 inner function, decorateurs, closures,
Pour rendre verifier que tout les exos sont bien des programmes avec main (day 3 a 5 surtout)
day4 ex04 et day5 ex00 formatage output float not good
                formatted_result = [round(x, 1) for x in result]
                print(f"{value} : {formatted_result}")