This project has been created as part of the 42 curriculum by dporhomo.
The Python Discovery Piscine is an intensive introductory course designed to build a solid foundation in Python 3. Over nine modules, the project covers the essential building blocks of the language, ranging from basic syntax and data types to functional programming concepts and data manipulation.
The goal was to transition from "knowing of" Python to being able to write functional, clean, and "Pythonic" scripts that handle user input, manipulate strings and arrays, manage system arguments, and process complex data structures like dictionaries.
- Python 3.x installed on your system.
- A terminal or command-line interface.
Most exercises are standalone scripts. You can run them by navigating to the specific module/exercise folder and using the following command:
python3 name_of_script.py [arguments]
Examples:
- Module 6 (CLI Arguments):
python3 upcase_it.py "hello"will outputHELLO. - Module 4 (User Input):
python3 calculator.pywill prompt for two numbers and display arithmetic results. - Module 9 (Dictionaries):
python3 family_affairs.pywill process a hardcoded dictionary to filter specific values.
AI was utilized during this project as a peer-learning tool to:
- Clarify the difference between
listandsetcomprehensions. - Debug specific
ValueErrorexceptions when handlingsys.argvinputs. - Refine logic for complex dictionary filtering and sorting in Module 9.
Integer/Float Validation: Implementing robust error handling using try/except blocks to manage ValueError during user input and system argument parsing.
Arithmetic Precision: Utilizing f-string formatting with :g for significant figure management in calculator logic.
Type Checking: Employing isinstance() to ensure function arguments meet expected data types (e.g., string validation).
Conditional Logic: Developing branching logic to handle state (e.g., positive, negative, or zero results).
Iterative Logic: implementing both while loops for continuous user interaction and for loops for list/argument processing.
Dictionary Processing: Using .items(), .keys(), and .values() to manipulate complex key-value datasets.
Higher-Order Functions: Implementing filter() and sorted() with custom lambda-style key functions to process data objects.
List & Set Comprehensions: Creating efficient, one-line data transformations including conditional filtering within the comprehension.
CLI Argument Parsing: Utilizing sys.argv to create command-line tools that accept external parameters.
String Manipulation: Applying .strip(), .capitalize(), .upper(), and .swapcase() to normalize and process text data.
RegEx Integration: Implementing the re module for pattern matching and search functionality.