Skip to content

Commit 122a32b

Browse files
committed
further improvement of the text
1 parent c6eaed6 commit 122a32b

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

text/main/basics/variables/assignment/assignment.tex

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,25 +169,36 @@
169169
Finally, \pythonil{print(f"new_var = \{new_var\}." )} then prints \textil{new_var = 14.0.}.%
170170
\end{sloppypar}%
171171
%
172-
The \acrfull{stdout} of the complete program is given in \cref{exec:variables:assignment}.
173-
For your convenience, we also showed the results when executing the program in \pycharm\ or the \ubuntu\ \pgls{terminal} in \cref{fig:variables:assignment}.
174-
They are obviously identical.
172+
This first program is stored in a file named~\textil{assignment.py}.
173+
To execute it, you have two choices:
174+
You can either open a \pgls{terminal} and enter the folder where the program is stored.
175+
Then you would execute the command~\bashil{python3 assignment.py} to run the \python\ interpreter in the terminal, as illustrated in \cref{fig:assignmentTerminal}~(for the case of \ubuntu\ \linux).
176+
177+
Alternatively, you can open the program file in \pycharm\ \pgls{ide}, as sketched in \cref{fig:assignmentPyCharm1}.
178+
You would then right-click on the file \textil{assignment.py} in the project tree view.
179+
In the popup-menu that opens, you would left-click on \menu{Run `assignment'} as shown in \cref{fig:assignmentPyCharm2}.
180+
As a shortcut, you can also simply press~\keys{\ctrl+\shift+F10}.
181+
Either way, \pycharm\ will run the program and the output appears in \cref{fig:assignmentPyCharm}.
182+
As you see, the full \acrfull{stdout} of the complete program given in \cref{exec:variables:assignment} is identical to what we get from the manual execution in either the \pgls{terminal} or \pycharm.
175183

176-
Notice that we wrote the names of variables in a certain style, which is somewhat standard in \python\ programming.
177-
For the sake of creating readable code that fits nicely together with code from other projects\dots%
184+
We are not completely done yet, though.
185+
Notice that we wrote the names of variables in a certain style, in lowercase letters.
186+
This is the defactor standard way to name variables and functions in \python\ programming.%
178187
%
179188
\bestPractice{variableNames}{%
180189
Variable names should be lowercase, with words separated by underscores~\cite{PEP8}.%
181190
}
182191
%
183-
We now have seen some best practices on styling our code, e.g., \cref{bp:variableNames,bp:longstrDoubleQuote,bp:comments}, and many more such best practices will follow.
184-
Before continuing further, let us revisit the deeper meaning behind them.
192+
This seems like a strange thing to introduce right at the beginning when learning programming.
193+
Matter of fact, we now have seen some best practices on styling our code, e.g., \cref{bp:variableNames,bp:longstrDoubleQuote,bp:comments}, and many more such best practices will follow.
194+
Before continuing further, let us therefore revisit the deeper meaning behind them.
185195
Why is it important to style our code in a consistent way?
186196
Why can't we just write things down in any way that pleases us?%
187197
%
188198
\bestPractice{codeStyle}{%
189199
Regardless which programming language you are using, it is important to write code and scripts in a consistent style, to use a consistent naming scheme for all things that can be named, and to follow the generally established best practices and norms for that language.%
190200
}%
201+
%
191202
For many programming languages, there exist comprehensive and clear style guides.
192203
Since we usually work collaboratively on larger projects, writing code in a consistent style is very important.
193204
Ideally, all collaborators can open a source code file and easily read and understand our code.

0 commit comments

Comments
 (0)