Skip to content

Commit 3180f1c

Browse files
committed
move to more REPL listings
1 parent 74ee518 commit 3180f1c

File tree

14 files changed

+62
-78
lines changed

14 files changed

+62
-78
lines changed

text/main/basics/simpleDataTypesAndOperations/bool/bool.tex

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@
77
%
88
\hsection{Comparisons}%
99
%
10-
\begin{figure}%
11-
\centering%
12-
\includegraphics[width=0.8\linewidth]{\currentDir/boolComparisons}%
13-
\caption{The results of basic comparisons are instances of \pythonilIdx{bool}.}%
14-
\label{fig:boolComparisons}%
15-
\end{figure}%
10+
\gitEvalPython{bool_comparisons}{}{simple_datatypes/bool_comparisons.py}%
11+
\listingBox{exec:bool_comparisons}{The results of basic comparisons are instances of \pythonilIdx{bool}.}{,style=python_console_style}%
1612
%
1713
In the sections on \pythonils{float}\pythonIdx{float} and \pythonils{int}\pythonIdx{int}, we learned how to do arithmetics with real and integer numbers.
1814
You have learned these operations already in preschool.
@@ -31,7 +27,7 @@
3127
%
3228
\end{itemize}%
3329
%
34-
How to use these operators is illustrated in \cref{fig:boolComparisons}.
30+
How to use these operators is illustrated in \cref{exec:bool_comparisons}.
3531
It shows that \pythonil{6 == 6}\pythonIdx{==} yields \pythonilIdx{True}, while \pythonil{6 != 6}\pythonIdx{"!=} yields \pythonilIdx{False}.
3632
The expression \pythonil{6 > 6}\pythonIdx{>} gives us \pythonilIdx{False}, but \pythonil{6 >= 6}\pythonIdx{>=} is \pythonilIdx{True}.
3733
\pythonil{6 < 6}\pythonIdx{<} is also \pythonilIdx{False} while \pythonil{6 <= 6} is, of course, \pythonilIdx{True}.
@@ -122,18 +118,14 @@
122118
}%
123119
%
124120
\caption{The truth tables for the Boolean operators \pythonilIdx{and}, \pythonilIdx{or}, and \pythonilIdx{not}.}%
125-
\label{fig:boolLogicTables}%
121+
\label{exec:bool_logicTables}%
126122
\end{figure}%
127123
%
128-
\begin{figure}%
129-
\centering%
130-
\includegraphics[width=0.8\linewidth]{\currentDir/boolLogic}%
131-
\caption{The \pythonilIdx{bool} values can be combined with the Boolean logical operators \pythonilIdx{and}, \pythonilIdx{or}, and \pythonilIdx{not}.}%
132-
\label{fig:boolLogic}%
133-
\end{figure}%
124+
\gitEvalPython{bool_logic}{}{simple_datatypes/bool_logic.py}%
125+
\listingBox{exec:bool_logic}{The \pythonilIdx{bool} values can be combined with the Boolean logical operators \pythonilIdx{and}, \pythonilIdx{or}, and \pythonilIdx{not}.}{,style=python_console_style}%
134126
%
135127
The most common operations with Boolean values are the well-known Boolean logical operators \pythonilIdx{and}, \pythonilIdx{or}, and \pythonilIdx{not}.
136-
Their truth tables are illustrated in \cref{fig:boolLogicTables}.%
128+
Their truth tables are illustrated in \cref{exec:bool_logicTables}.%
137129
%
138130
\begin{itemize}%
139131
%
@@ -147,7 +139,7 @@
147139
\end{itemize}%
148140
%
149141
\begin{sloppypar}%
150-
In \cref{fig:boolLogic} we explore these three operators in the \python\ console.
142+
In \cref{exec:bool_logic} we explore these three operators in the \python\ console.
151143
You can see that the operations can be used exactly as in the truth tables and yield the expected results.
152144
Additionally, you can of course nest and combine Boolean operators using parentheses\pythonIdx{(}\pythonIdx{)}.
153145
For example, \pythonil{(True or False) and ((False or True) or (False and False))} resolves to \pythonil{True and (True or False)}, which becomes \pythonil{True and True}, which ultimately becomes \pythonilIdx{True}.
Binary file not shown.
Binary file not shown.

text/main/basics/simpleDataTypesAndOperations/documentation/documentation.tex

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,13 @@
358358
%
359359
\item Code that we cannot explain with our own words is wrong.%
360360
%
361+
\item \pglspl{AI} can only give good suggestions for questions and situations that are similar to what has been in their training data. %
362+
They can work well if you, say, ask how to load data from a text file, separate it into columns, and then create a \sqlil{INSERT INTO} query in \sql\ to send the data to a \dbms. %
363+
They cannot work well if you ask questions that involve new scenarios. %
364+
If you study as a Master's or PhD student, then most likely your programming issues involve exactly such new scenarios. %
365+
Because part of your work is research. %
366+
Using an \pgls{AI} in a situation where you have to do something that nobody has done before is very very dangerous and its results are much more likely to be wrong or incomplete or not cover corner cases.%
367+
%
361368
\item Tools like \pglspl{LLM} incentivize laziness. %
362369
Even if the tools gave us correct results that passed our scrutinization several times, it is necessary to maintain proper discipline and continue to always and every time check their output. %
363370
Such discipline is against the human nature of laziness and therefore must be consciously maintained.%
@@ -381,6 +388,21 @@
381388
Documentation, i.e., the textual description of what the software does, must be done by actual people who fully understand the software.%
382389
}%
383390
%
391+
There is another issue with the use of \pgls{AI}.
392+
Remember back when you were in primary school.
393+
During the first few years of maths lessons, you never got to use a calculator.
394+
Of course, your teachers knew very well that you will use calculators or other computing devises to do calculations in your later life and rarely compute things by hand or in your head.
395+
Yet, they did not give you a calculator right from the start.
396+
Even though they knew you would use calculating machines later.
397+
Why was that?
398+
399+
It was because you were supposed to learn how maths works.
400+
If a calculator was given to you, then you would have learned how to use a calculator.
401+
But your understanding of mathematics would be very very limited.
402+
403+
Right now, you are supposed to learn how programming works.
404+
If you would ask an \pgls{AI} to answer your programming questions, you would learn how to use the \pgls{AI}.
405+
But your understanding of programming would be very very limited.%
384406
%
385407
\begin{figure}%
386408
\centering%
Binary file not shown.

text/main/basics/simpleDataTypesAndOperations/none/none.tex

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
\hsection{None}%
22
\label{sec:none}%
33
%
4-
\begin{figure}%
5-
\centering%
6-
\includegraphics[width=0.7\linewidth]{\currentDir/none}%
7-
\caption{Examples of using the value \pythonil{None}.}%
8-
\label{fig:none}%
9-
\end{figure}%
4+
\gitEvalPython{none}{}{simple_datatypes/none.py}%
5+
\listingBox{exec:none}{Examples of using the value \pythonil{None}.}{,style=python_console_style}%
106
%
117
The last simple type we talk about is the \pythonilIdx{NoneType} and its one single value:~\pythonilIdx{None}.
128
Now you already learned the type \pythonil{bool} which can take on only two different values, \pythonil{True} and~\pythonil{False}.
@@ -18,7 +14,7 @@
1814
\pythonilIdx{None} is not equivalent to \pythonil{0}, it is not equivalent to~\pythonilIdx{nan}, and also different from the empty string~\pythonil{""}\pythonIdx{\textquotedbl\textquotedbl}.
1915
It is just nothing.
2016

21-
\cref{fig:none} illustrates some of the things we can do with \pythonilIdx{None}.
17+
\Cref{exec:none} illustrates some of the things we can do with \pythonilIdx{None}.
2218
If we write \pythonilIdx{None} into the \python\ console, then nothing happens.
2319
In the past, we just wrote values, such as \pythonil{34} and, after we hit \keys{\enter}, they would be printed again.
2420
Not so~\pythonilIdx{None}.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)