Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Programming course
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
courses
Programming course
Commits
64977f7d
Commit
64977f7d
authored
6 years ago
by
Mihai Lefter
Browse files
Options
Downloads
Patches
Plain Diff
Finished introduction
parent
519ebb17
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
introduction/introduction/introduction.tex
+82
-9
82 additions, 9 deletions
introduction/introduction/introduction.tex
with
82 additions
and
9 deletions
introduction/
presenta
tion/introduction.tex
→
introduction/
introduc
tion/introduction.tex
+
82
−
9
View file @
64977f7d
...
...
@@ -31,8 +31,23 @@
left=0.1cm,
arc=0mm,
colframe=black]
}
{
\end{tcolorbox}
}
{
\end{tcolorbox}
}
\newenvironment
{
terminal
}
{
\begin{tcolorbox}
[title=terminal,
title filled=false,
fonttitle=
\scriptsize
,
fontupper=
\footnotesize
,
enhanced,
colback=monokaibg,
drop small lifted shadow,
boxrule=0.1mm,
left=0.1cm,
arc=0mm,
colframe=black]
}
{
\end{tcolorbox}
}
\newcommand
{
\hrefcc
}
[2]
{
\textcolor
{
#1
}{
\href
{
#2
}{
#2
}}}
\newcommand
{
\hrefc
}
[3]
{
\textcolor
{
#1
}{
\href
{
#2
}{
#3
}}}
...
...
@@ -287,15 +302,73 @@
We'll use Python 3.7 for this course.
\end{pframe}
% \subsection{}
% \begin{pframe}
% \begin{itemize}
% \item
% \end{itemize}
% \end{pframe}
\section
{
Python as a calculator
}
\section
{
Running Python code
}
\begin{pframe}
Two main ways of writing and executing Python code:
\begin{itemize}
\item
Interactively:
\begin{itemize}
\item
Statement by statement, directly in the interpreter.
\end{itemize}
\item
Non-interactively:
\begin{itemize}
\item
By editing in a file and running the code afterwards.
\end{itemize}
\end{itemize}
\end{pframe}
\subsection
{
The standard Python interpreter
}
\begin{pframe}
Start it by typing
\textbf
{
python
}
on the command line:
\begin{terminal}
\color
{
white
}{
\begin{lstlisting}
[frame=,style=,numbers=none]
$
python
Python
3
.
7
(
default, Nov
12
2018
,
13
:
43
:
14
)
[
GCC
5
.
4
.
0
20160609
]
on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
\end
{
lstlisting
}}
\end
{
terminal
}
\begin
{
itemize
}
\item
It shows an interpreter prompt.
\item
You can give it Python code to interpret.
\end
{
itemize
}
\end
{
pframe
}
\subsection
{
The IPython interpreter
}
\begin
{
pframe
}
Similar to the standard Python interpreter, but with:
\begin
{
itemize
}
\item
syntax highlighting;
\item
tab completion;
\item
cross
-
session history,
\item
etc.
\end
{
itemize
}
Start it by typing
\textbf
{
ipython
}
on the command line:
\begin
{
terminal
}
\color
{
white
}{
\begin
{
lstlisting
}
[
frame
=
,style
=
,numbers
=
none
]
$
ipython
Python 3.7 (default, Nov 12 2018, 13:43:14)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help.
\end{lstlisting}
}
\begin{pythonin}
{
python
}
\end{pythonin}
\addtocounter
{
cntr
}{
-1
}
\end{terminal}
\begin{itemize}
\item
It shows an interpreter prompt.
\item
You can give it Python code to interpret.
\end{itemize}
\end{pframe}
\section
{
Python as a calculator
}
\subsection
{
Integers
}
\begin{pframe}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment