Python for Beginners
المستويات الدراسية: Grade 12
النظام التعليمي: American
Learn Python programming from scratch.
#Python
Learn Python programming from scratch.
#Python
1. Install CPython 3.x and verify the interpreter from the command line (e.g., python --version).
2. Create and activate an isolated virtual environment with python -m venv and confirm site-packages are sandboxed.
3. Manage packages with pip (install, upgrade, uninstall) and export dependencies with pip freeze > requirements.txt.
4. Configure VS Code (or comparable IDE) to run Python scripts, open an integrated terminal, and launch the REPL.
5. Run Python code from the terminal, in the REPL, and in a Jupyter Notebook to validate the toolchain.
1. Declare and use variables of built-in types (int, float, str, bool) and perform explicit type conversions.
2. Evaluate expressions using arithmetic, comparison, logical, and membership operators to compute results.
3. Implement decision logic with if/elif/else using clear boolean conditions and operator precedence.
4. Construct loops (for with range and while) using iteration patterns, break/continue, and loop else clauses where appropriate.
5. Produce console I/O with input and print, formatting output with f-strings and format specifiers.
1. Create, access, and mutate lists and dictionaries using indexing, slicing, and methods (append, extend, pop, update).
2. Select appropriate data structures based on mutability, ordering, and lookup characteristics for a given problem.
3. Construct list, set, and dict comprehensions to filter, map, and transform collections concisely.
4. Iterate over collections using enumerate, zip, and dict items/keys/values to process compound data.
5. Sort sequences using sorted or list.sort with key functions and lambda expressions to achieve custom orderings.
1. Define functions using positional, keyword, default, and variable-length parameters and return computed results.
2. Document functions with clear docstrings describing purpose, parameters, return values, and examples.
3. Encapsulate logic in modules; import and reuse functions across files using absolute or relative imports.
4. Apply Python’s scope rules (local, nonlocal, global) to control variable visibility and avoid unintended side effects.
5. Handle runtime errors using try/except/else/finally and raise appropriate exceptions to signal invalid states.
6. Import and apply standard-library modules (e.g., math, statistics, random) to implement common computations.
1. Read and write text files using with statements and appropriate encodings to ensure correct resource management.
2. Parse and generate CSV files using csv.reader/csv.DictReader and csv.writer for tabular data.
3. Serialize and deserialize JSON using json.load/json.dump with correct Python data structures.
4. Manage file paths and directories with pathlib to create, inspect, and traverse cross-platform file systems.
5. Validate and transform raw text data (strip, split, join, cast) prior to storage or further processing.
1. Write unit tests with pytest that assert expected outputs and edge cases for individual functions.
2. Execute and interpret pytest results using test discovery and basic fixtures to isolate test setup.
3. Debug programs by setting breakpoints and stepping through execution in an IDE or with pdb to inspect state.
4. Configure logging with logging.basicConfig and emit messages at appropriate levels instead of using print.
5. Format code automatically with Black and resolve linting issues reported by Flake8 to meet PEP 8 style.
6. Initialize a Git repository, create meaningful commits, and push to a remote to maintain version history.