diff --git a/docs/source/book/01_intro/index.rst b/docs/source/book/01_intro/index.rst index 9bc2210..17bed4f 100644 --- a/docs/source/book/01_intro/index.rst +++ b/docs/source/book/01_intro/index.rst @@ -5,7 +5,7 @@ .. _intro_index: 1. Preparing for work -********************** +===================== In order to start working with Python, you need to decide on a few things: diff --git a/docs/source/book/03_start/index.rst b/docs/source/book/03_start/index.rst index de21ad4..50529da 100644 --- a/docs/source/book/03_start/index.rst +++ b/docs/source/book/03_start/index.rst @@ -8,7 +8,7 @@ ============================ -This section examines: +This section covers: - Python syntax - Work in interactive mode @@ -18,8 +18,8 @@ This section examines: .. toctree:: :maxdepth: 1 - 0_syntax - 1_ipython - 1a_ipython_magic - 2_variables + syntax + ipython + ipython_magic + variables ../../exercises/03_exercises diff --git a/docs/source/book/03_start/1_ipython.rst b/docs/source/book/03_start/ipython.rst similarity index 97% rename from docs/source/book/03_start/1_ipython.rst rename to docs/source/book/03_start/ipython.rst index 23ec07a..e7a6cea 100644 --- a/docs/source/book/03_start/1_ipython.rst +++ b/docs/source/book/03_start/ipython.rst @@ -6,10 +6,10 @@ Interpreter makes it possible to receive an instant response to executed actions In previous section, a standard interpreter was called to verify Python installation. There is also an improved interpreter `IPython `__. Ipython allows much more than standard interpreter called by "python" command. Some examples (Ipython features are much broader): -- Autocomplete Tab commands or hints if there are more than one command variant; -- More structured and understandable output of commands; -- Automatic indentation in loops and other objects; -- You can either walk through the command execution history or watch it with %history 'magic' command. +- Autocomplete Tab commands or hints if there are more than one command variant +- More structured and understandable output of commands +- Automatic indentation in loops and other objects +- You can either walk through the command execution history or watch it with %history 'magic' command You can install Ipython using pip (installation will be done in a virtual environment if configured): diff --git a/docs/source/book/03_start/1a_ipython_magic.rst b/docs/source/book/03_start/ipython_magic.rst similarity index 100% rename from docs/source/book/03_start/1a_ipython_magic.rst rename to docs/source/book/03_start/ipython_magic.rst diff --git a/docs/source/book/03_start/0_syntax.rst b/docs/source/book/03_start/syntax.rst similarity index 81% rename from docs/source/book/03_start/0_syntax.rst rename to docs/source/book/03_start/syntax.rst index a94a006..56fc6f6 100644 --- a/docs/source/book/03_start/0_syntax.rst +++ b/docs/source/book/03_start/syntax.rst @@ -1,10 +1,10 @@ Python syntax ~~~~~~~~~~~~~~~~ -The first thing that meets the eye when it comes to Python syntax is that indentation matters: +The first thing that tends to catch your eye when it comes to Python syntax is that indentation matters: -- It determines which code enters the block; -- When a block of code starts and ends. +- It determines which code is inside the block +- When a block of code starts and ends Example of Python code: @@ -29,10 +29,10 @@ Example of Python code: print("Ready") .. note:: - This code is shown for syntax demonstration. Although if/else construction has not yet been considered, it is likely that the meaning of code will be understood. + This code is shown for syntax demonstration. Although if/else construction has not yet been covered, it is likely that the meaning of code will be clear in general. Python understands which lines refer to "if" on indentation basis. -Execution of a block ``if a > b`` ends when another string with the same indent as string ``if a > b`` appears. Similarly to block “else”. +Execution of a block ``if a > b`` ends when another string with the same indent as string ``if a > b`` appears. Similarly to block ``else``. The second feature of Python is that some expressions must be followed by colon (for example, after ``if a > b`` and after ``else``). Several rules and recommendations on indentation: @@ -59,9 +59,9 @@ Comments in Python can be one-line: a = 10 b = 5 # A much needed comment -One-line comments start with pound sign. Note that comment can be in line where code itself is or in a separate line. +One-line comments start with hash sign. Note that comment can be in line where code itself is or in a separate line. -If it is necessary to write several lines with comments in order to not put pound sign before each line, you can make a multi-line comment: +If it is necessary to write several lines with comments in order to not put hash sign before each line, you can make a multi-line comment: .. code:: python diff --git a/docs/source/book/03_start/2_variables.rst b/docs/source/book/03_start/variables.rst similarity index 91% rename from docs/source/book/03_start/2_variables.rst rename to docs/source/book/03_start/variables.rst index c0f11ec..f99ff0e 100644 --- a/docs/source/book/03_start/2_variables.rst +++ b/docs/source/book/03_start/variables.rst @@ -3,9 +3,9 @@ Variables Variables in Python do not require variable type declaration (since Python is a language with dynamic typing) and they are references to a memory area. Variable naming rules: -- Name of variable can consist only of letters, digits and an underscore; -- Name cannot start with a digit; -- Name cannot contain special characters @, $, %. +- Name of variable can consist only of letters, digits and an underscore +- Name cannot start with a digit +- Name cannot contain special characters @, $, % An example of creating variables in Python: @@ -22,7 +22,7 @@ An example of creating variables in Python: Note that Python does not need to specify that "a" is a number, and "b" is a string. -Variables are references to memory area. This can be demonstrated by using id() which shows object ID: +Variables are references to memory area. This can be demonstrated by using ``id()`` which shows object ID: .. code:: python @@ -100,7 +100,7 @@ Variable names Variable names should not overlap with names of operators and modules or other reserved words. Python has recommendations for naming functions, classes and variables: -- variable names are usually written in lowercase or in uppercase (e.g., DB_NAME, db_name); -- function names are written in lowercase, with underline between words (for example get_names); -- class names are given with capital letters without spaces, it is called CamelCase (for example, CiscoSwitch). +- variable names are usually written in lowercase or in uppercase (e.g., DB_NAME, db_name) +- function names are written in lowercase, with underline between words (for example get_names) +- class names are given with capital letters without spaces, it is called CamelCase (for example, CiscoSwitch)