From 6146bc4dbc148d5efa84bfc78f9ef3fb44ce0a71 Mon Sep 17 00:00:00 2001 From: HARSH VERMA Date: Fri, 6 Feb 2026 23:31:51 +0530 Subject: [PATCH] Improve Python course documentation --- README.md | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f53cdf8f..2ad76fcf 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Playground and Cheatsheet for Learning Python -> πŸ‡ΊπŸ‡¦ UKRAINE [IS BEING ATTACKED](https://war.ukraine.ua/) BY RUSSIAN ARMY. CIVILIANS ARE GETTING KILLED. RESIDENTIAL AREAS ARE GETTING BOMBED. +> πŸ‡ΊπŸ‡¦ UKRAINE [IS BEING ATTACKED](https://war.ukraine.ua/) BY THE RUSSIAN ARMY. CIVILIANS ARE GETTING KILLED. RESIDENTIAL AREAS ARE GETTING BOMBED. > - Help Ukraine via: > - [Serhiy Prytula Charity Foundation](https://prytulafoundation.org/en/) > - [Come Back Alive Charity Foundation](https://savelife.in.ua/en/donate-en/) @@ -34,6 +34,7 @@ without launching them. Each Python script in this repository has the following structure: ```python + """Lists <--- Name of the topic here # @see: https://www.learnpython.org/en/Lists <-- Link to further readings goes here @@ -50,12 +51,20 @@ def test_list_type(): # Here is an example of how to build a list. <-- Comments here explain the action squares = [1, 4, 9, 16, 25] + cubes = [1, 8, 27, 64, 125] - # Lists can be indexed and sliced. + # Lists can be indexed, sliced and even merged. + # Indexing returns the item. assert squares[0] == 1 # <-- Assertions here illustrate the result. + # Slicing returns a new list. assert squares[-3:] == [9, 16, 25] # <-- Assertions here illustrate the result. + + # Merging returns a new combined list. + merged = squares + cubes + assert merged == [1, 4, 9, 16, 25, 1, 8, 27, 64, 125] + ``` So normally you might want to do the following: @@ -65,7 +74,7 @@ So normally you might want to do the following: - Look at code examples and assertions to see usage examples and expected output. - Change code or add new assertions to see how things work. - [Run tests](#testing-the-code) and [lint the code](#linting-the-code) to see if it work and is -written correctly. + written correctly. ## Table of Contents @@ -155,7 +164,9 @@ by running `pip` or `pip3`. You may check your Python version by running: ```bash + python --version + ``` Note that in this repository whenever you see `python` it will be assumed that it is Python **3**. @@ -165,7 +176,9 @@ Note that in this repository whenever you see `python` it will be assumed that i Install all dependencies that are required for the project by running: ```bash + pip install -r requirements.txt + ``` ## Testing the Code @@ -178,13 +191,17 @@ You may add new tests for yourself by adding files and functions with `test_` pr To run all the tests please execute the following command from the project root folder: ```bash + pytest + ``` To run specific tests please execute: ```bash + pytest ./path/to/the/test_file.py + ``` ## Linting the Code @@ -197,14 +214,18 @@ To check if the code is written with respect to [PEP 8](https://www.python.org/dev/peps/pep-0008/) style guide please run: ```bash + pylint ./src/ + ``` In case if linter will detect error (i.e. `missing-docstring`) you may want to read more about specific error by running: ```bash + pylint --help-msg=missing-docstring + ``` [More about PyLint](http://pylint.pycqa.org/) @@ -215,13 +236,17 @@ To check if the code is written with respect to [PEP 8](https://www.python.org/dev/peps/pep-0008/) style guide please run: ```bash + flake8 ./src + ``` Or if you want to have more detailed output you may run: ```bash + flake8 ./src --statistics --show-source --count + ``` [More about Flake8](http://flake8.pycqa.org/en/latest/)