\documentclass[
handout
]{beamer}

\input{macros.tex}

\begin{document}
\title{Programación I}
\author{Luis Llana Díaz}
\institute{Departamento de Sistemas Informáticos y Computación\\Universidad Complutense de Madrid}
\maketitle

\def\acc#1{{\color{red}\uppercase{#1}}}

\begin{frame}{Computer Memory}
  Computer have two main types of memory:
  \begin{itemize}[<+->]
  \item \textbf{Primary Memory} (Main Memory, RAM)
    \begin{itemize}
    \item Fast
    \item Volatile
    \item Small capacity (*)
    \end{itemize}
  \item \textbf{Permanent Memory} (Storage)
    \begin{itemize}
    \item Slow
    \item Non-volatile
    \item Large capacity (*)
    \end{itemize}
  \end{itemize}
  \textbf{(*)} Large and small are very relative terms.
\end{frame}

\begin{frame}{Primary Memory vs Permanent Memory}
  \begin{itemize}[<+->]
  \item Primary memory is used to store data and programs that are being
    used at the moment.
  \item Permanent memory is used to store data and programs that are not
    being used at the moment, but will be used in the future.
  \item Data and programs are loaded from permanent memory to primary
    memory when they are needed.
  \item Data and programs are saved from primary memory to permanent
    memory when they are no longer needed.
  \end{itemize}
\end{frame}

\begin{frame}{How data is organized in RAM}
  \begin{columns}
    \begin{column}{0.5\textwidth}
      \begin{itemize}[<+->]
      \item Primary memory is organized in \textbf{cells}.
      \item Each cell has a unique \textbf{address}.
      \item Each cell can store a fixed number of \textbf{bits} (usually
        8 bits = 1 byte).
      \item Each cell can store a \textbf{value} (data).
      \end{itemize}
    \end{column}
    \begin{column}{0.5\textwidth}
      \begin{center}
        % a latex table with, addresses and values in memory
        % the foreground of values is  in salmon
        \begin{tabular}{|c|c|}
          \hline
          \textbf{Address} & \textbf{Value} \\
          \hline
          0x0000 & {\color{salmon}25} \\
          \hline
          0x0001 & {\color{salmon} 0} \\
          \hline
          0x0002 & {\color{salmon} 65} \\
          \hline
          0x0003 & {\color{salmon} 0} \\
          \hline
          \multicolumn{2}{|c|}{\vdots} \\
          \hline
        \end{tabular}
      \end{center}
    \end{column}
  \end{columns}
\end{frame}

\begin{frame}
  \frametitle{What is a variable?}
  \begin{columns}
    \begin{column}{0.5\textwidth}
      \begin{itemize}
      \item<1-> Values are stored in cells of  memory.
      \item<3-> If my computer has 16Gb. of RAM, it has approximately
        $16\cdot 2^{30}\approx 16.000.000.000$ cells.
      \item<4-> A human cannot remember the address of each cell.
      \item<5-> Instead of using the address of the cell, we use a
        \textbf{variable name} to refer to the cell.
      \item<6-> A \textbf{variable} is a name that refers to a cell in
        memory.
      \end{itemize}
    \end{column}
    \begin{column}{0.5\textwidth}
      % a tick piture. A cloud vith values: an integer, a bool, a
      % string, a float. External nams with links to the values
      \scalebox{0.7}{%
      \begin{tikzpicture}[
        value_node/.style={fill=white, draw=gray, rounded corners, inner sep=4pt, font=\ttfamily},
        var_name_node/.style={font=\sffamily\bfseries, text=blue!70!black}
        ]

        % 1. Define the individual values (data) inside the "memory
        % cloud"
        \node[value_node, visible on=<2->] (val-int) {42};
        \node[value_node, below=1cm of val-int, visible on=<2->] (val-string) {\lstinline|Hello!|};
        \node[value_node, above left=0.5cm and 0.5cm of val-int, visible on=<2->] (val-bool) {\lstinline|True|};
        \node[value_node, below left=0.5cm of val-int, visible on=<2->] (val-float) {3.14159};

        % 2. Draw the cloud encompassing these values
        \node[cloud, cloud puffs=10, cloud puff arc=120, aspect=1, draw, thick, blue!50!cyan, %fill=blue!5!white,
          inner sep=10pt, fit=(val-int) (val-bool) (val-string)
          (val-float), visible on=<1->] (memory_cloud) {};

        % Label for the cloud
        \node[below=0.3cm of memory_cloud, font=\sffamily\small, text=gray] {Computer Memory};

        % 3. Define the external variable names
        \node[var_name_node, below left=0.5cm and 1cm of memory_cloud,
          visible on=<7->] (var-message) {\lstinline|greeting|};
        \node[var_name_node, above left=0.5cm and 1cm of memory_cloud, visible on=<8->] (var-status) {\lstinline|is_loaded|};
        \node[var_name_node, below left=-1.0cm and 1cm of memory_cloud, visible on=<9->] (var-pi) {\lstinline|pi_value|};
        \node[var_name_node, left=1.5cm of memory_cloud, visible on=<10->] (var-age) {\lstinline|age|};

        % 4. Draw the links (arrows) from variable names to their respective values
        \draw[->, thick, orange!70!black, visible on=<7->] (var-message) -- (val-string);
        \draw[->, thick, green!70!black, visible on=<8->] (var-status) -- (val-bool);
        \draw[->, thick, purple!70!black, visible on=<9->] (var-pi) -- (val-float);
        \draw[->, thick, red!70!black, visible on=<10->] (var-age) -- (val-int);
      \end{tikzpicture}}
    \end{column}
  \end{columns}
\end{frame}

\begin{frame}[fragile]
  \frametitle{Assignation instruction}
\begin{lstlisting}
age = 42
greeting = 'Hello!'
is_loaded = True
pi_value = 3.14159
\end{lstlisting}
  \pause
  \visible<+->{An assignation is an instruction with two parts (divided the by}
  \lstinline|=| symbol)
  \begin{description}[<+->]
  \item[Right part.] It is an
    \emph{expression}.
  \item[Left part] It is a \emph{variable}.
  \end{description}
  \visible<+->{The execution of the assignation instruction}
  \begin{enumerate}[<+->]
  \item The computer \emph{evaluates} the expression.
  \item It stores the result in the memory.
  \item The variable \emph{references} to the cell of memory.
  \end{enumerate}
\end{frame}

\begin{frame}[fragile]{Execution of assignment instruction}
  \begin{columns}
    \begin{column}{0.5\textwidth}
\begin{lstlisting}
age = 42
greeting = 'Hello!'
is_loaded = True
pi_value = 3.14159
\end{lstlisting}
    \end{column}
    \begin{column}{0.5\textwidth}
      \scalebox{0.7}{%
      \begin{tikzpicture}[
        value_node/.style={fill=white, draw=gray, rounded corners, inner sep=4pt, font=\ttfamily},
        var_name_node/.style={font=\sffamily\bfseries, text=blue!70!black}
        ]

        % 1. Define the individual values (data) inside the "memory
        % cloud"
        \node[value_node, visible on=<2->] (val-int) {42};
        \node[value_node, below=1cm of val-int, visible on=<4->] (val-string) {\lstinline|Hello!|};
        \node[value_node, above left=0.5cm and 0.5cm of val-int, visible on=<6->] (val-bool) {\lstinline|True|};
        \node[value_node, below left=0.5cm of val-int, visible on=<8->] (val-float) {3.14159};

        % 2. Draw the cloud encompassing these values
        \node[cloud, cloud puffs=10, cloud puff arc=120, aspect=1, draw, thick, blue!50!cyan, %fill=blue!5!white,
          inner sep=10pt, fit=(val-int) (val-bool) (val-string)
          (val-float), visible on=<1->] (memory_cloud) {};

        % Label for the cloud
        \node[below=0.3cm of memory_cloud, font=\sffamily\small, text=gray] {Computer Memory};

        % 3. Define the external variable names
        \node[var_name_node, left=1.5cm of memory_cloud, visible on=<3->] (var-age) {\lstinline|age|};
        \node[var_name_node, below left=0.5cm and 1cm of memory_cloud,
          visible on=<5->] (var-message) {\lstinline|greeting|};
        \node[var_name_node, above left=0.5cm and 1cm of memory_cloud, visible on=<7->] (var-status) {\lstinline|is_loaded|};
        \node[var_name_node, below left=-1.0cm and 1cm of memory_cloud, visible on=<9->] (var-pi) {\lstinline|pi_value|};

        % 4. Draw the links (arrows) from variable names to their respective values
        \draw[->, thick, red!70!black, visible on=<3->] (var-age) -- (val-int);
        \draw[->, thick, orange!70!black, visible on=<5->] (var-message) -- (val-string);
        \draw[->, thick, green!70!black, visible on=<7->] (var-status) -- (val-bool);
        \draw[->, thick, purple!70!black, visible on=<9->] (var-pi) -- (val-float);
      \end{tikzpicture}}
    \end{column}
  \end{columns}
\end{frame}

\begin{frame}[fragile]
  \frametitle{The order is important}
  \begin{columns}
    \begin{column}{0.5\textwidth}
\begin{lstlisting}
a = 10
a = a + 1
\end{lstlisting}
    \end{column}
    \begin{column}{0.5\textwidth}
      \scalebox{0.7}{%
      \begin{tikzpicture}[
        value_node/.style={fill=white, draw=gray, rounded corners, inner sep=4pt, font=\ttfamily},
        var_name_node/.style={font=\sffamily\bfseries, text=blue!70!black}
        ]

        % 1. Define the individual values (data) inside the "memory
        % cloud"
        \node[value_node, visible on=<2->] (val-ini) {10};
        \node[value_node, below=1cm of val-ini, visible on=<4>] {\lstinline|a + 1|};
        \node[value_node, below=1cm of val-ini, visible on=<5->] (val-fin) {\lstinline|11|};

        % 2. Draw the cloud encompassing these values
        \node[cloud, cloud puffs=10, cloud puff arc=120, aspect=1, draw, thick, blue!50!cyan, %fill=blue!5!white,
          inner sep=10pt, fit=(val-ini) (val-fin), visible on=<1->] (memory_cloud) {};

        % Label for the cloud
        \node[below=0.3cm of memory_cloud, font=\sffamily\small, text=gray] {Computer Memory};

        % 3. Define the external variable names
        \node[var_name_node, left=1.5cm of memory_cloud, visible on=<3->] (var) {\lstinline|a|};

        % 4. Draw the links (arrows) from variable names to their respective values
        \draw[->, thick, red!70!black, visible on=<3-4>] (var) -- (val-ini);
        \draw[->, thick, red!70!black, visible on=<6->] (var) -- (val-fin);
      \end{tikzpicture}}

    \end{column}
  \end{columns}
\end{frame}

\begin{frame}
  \frametitle{Expressions}
  \visible<+->{
    An expression is a combination of \emph{values}, \emph{variables}, and \emph{operators}
    that can be:}
  \begin{itemize}[<+->]
  \item Evaluated to produce a value.
  \item Used as part of an instruction.
  \end{itemize}

  \visible<+->{The \emph{values} and \emph{operators} depends on the
  \emph{data types}. The basic data types in Python are}
  \begin{itemize}[<+->]
  \item \textbf{Integer} (int): whole numbers, e.g., 42, -3, 0.
  \item \textbf{Floating-point} (float): numbers with decimal
    points, e.g., 3.14, -0.001. \emph{real numbers}
  \item \textbf{String} (str): sequences of characters, e.g., "Hello",
    'Python'.
  \item \textbf{Boolean} (bool): logical values, either True or False.
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Integers}

  Although our programs use ordinary base 10 representation of numbers, the
  computers always work in binary (base 2 representation of numbers).
  \begin{block}{Byte}<+->
    \begin{itemize}[<+->]
    \item The basic data type in a computer is a \emph{byte}: a
      sequence of 8 bits.
    \item A bit can be either 0 or 1.

    \item Therefore, a byte can represent $2^8=256$ different values
      (from 0 to 255).
    \item We need a byte to represent the sing (positive or
      negative). So a byte can represent integers from -128 to 127.
    \end{itemize}
  \end{block}
\end{frame}
\begin{frame}
  \frametitle{Integers in programming}
  \begin{block}{64-bit integers}<1->
    \begin{itemize}
    \item<2-> Most languages use 32-bit or 64-bit integers, that is 4
      bytes or 8 bytes.
    \item<3-> They take together 4 or 8 bytes to represent
      an integer.
    \item<4->
      So the can represent integers in the range $-2^{31}$ to
      $2^{31}-1$ (32-bit integers), or $-2^{63}$ to $2^{63}-1$ (64-bit
      integers)
    \end{itemize}
  \end{block}

  \begin{block}{Integers in Python}<5->
    In Python, integers can be of arbitrary size, it can join any
    number of bytes to form an integer.
  \end{block}
\end{frame}

\begin{frame}
  \frametitle{Integer operations}
  The basic operations on integers are
  \begin{itemize}[<+->]
  \item Addition: \lstinline|+|, e.g., \lstinline|2 + 3 = 5|.
  \item Subtraction: \lstinline|-|, e.g., \lstinline|2 - 5 = -3|.
  \item Multiplication: \lstinline|*|, e.g., \lstinline|4 * 3 = 12|.
  \item Exponentiation: \lstinline|**|, e.g., \lstinline|2 ** 3 = 8| (2 raised to the power of 3).
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Integer operations. Division}
  \visible<+->{Let us remind the integer division
  $$ \mathit{dividend} = \mathit{divisor} \cdot \mathit{quotient} +
  \mathit{remainder} $$}

  \begin{itemize}[<+->]
  \item Integer division: \lstinline|//|, e.g., \lstinline|10 // 3 = 3| (the quotient of
    the integer division).
    the integer part of the division).
  \item Modulus: \lstinline|\%|, e.g., \lstinline|10 \% 3 = 1| (is the remainder of
    the division).
  \item Division: \lstinline|/|, e.g., \lstinline|10 / 2 = 5.0| (note that the
    result is always a
    \emph{float number}, not an integer).
  \end{itemize}
\end{frame}


\begin{frame}
  \frametitle{Examples}
  \begin{tabular}{|l|l|}
    Expression& result\\
    \hline
    \lstinline|2 + 3 * 4| & 14 \\
    \lstinline|(2 + 3) * 4| & 20 \\
    \lstinline|10 / 3| & 3.3333333333333335 \\
    \lstinline|10 // 3| & 3 \\
    \lstinline|10 \% 3| & 1 \\
    \lstinline|4 * 2 ** 3| & 32 \\
    \lstinline|(4 * 2) ** 3| & 512 \\
    \hline
  \end{tabular}
\end{frame}

\begin{frame}{Precedences}
    The precedence of operators is as follows (from highest to lowest):
    \begin{itemize}[<+->]
    \item Parentheses: `()`
    \item Exponentiation: `**`
    \item Multiplication, Division, Integer Division, Modulus: `*`, `/`, `//`, `%`
    \item Addition and Subtraction: `+`, `-`
    \end{itemize}
    \visible<+->{Operators with the same precedence are evaluated
      from left to right.}\\
    \visible<+->{In case of doubt, parentheses can be used to change the order of evaluation.}
  \end{frame}


\begin{frame}
  \frametitle{Floating point numbers}
  \begin{itemize}[<+->]
  \item What is a real number?
  \item What is the value of $\pi$?
  \end{itemize}
  \begin{block}<+->{Real numbers cannot be represented exactly in a computer}
      A computer can only represent a approximation of real numbers
      Therefore, it uses an
      approximation of real numbers called \textbf{floating-point
      numbers}.
  \end{block}
\end{frame}

\begin{frame}
        \frametitle{Scientific Notation}
        $$0.{\color{red}9865687}\color{black}\cdot 10^{{\color{blue}13}}$$
        \begin{itemize}[<+->]
        \item The mantissa is an integer (in this case
          {\color{red}9865687}).
          The mantissa expresses the precision of the number.
        \item The exponent is an integer (in this case
          {\color{blue}13}).
          The exponent expresses the scale of the number.
  \end{itemize}
\end{frame}
\begin{frame}
  \frametitle{float64}
  \begin{visibleenv}<+->
    Python uses float64 to represent floating-point numbers.
    \begin{center}
      \includegraphics[width=0.9\hsize]{float64}
    \end{center}
  \end{visibleenv}
  \begin{itemize}[<+->]
  \item 64 bits (8 bytes) to represent a floating-point number.
  \item 1 bit for the sign (positive or negative).
  \item 11 bits for the exponent (from -1023 to 1024). ($10^{-308}$ to
    $10^{308}$)
  \item 52 bits for the mantissa (from 0 to $2^{52}-1$). (15-17
    decimal digits).
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Operations}
  The basic operations on floating-point numbers are
  \begin{itemize}[<+->]
  \item Addition: \lstinline|+|, e.g., \lstinline|4.5 + 3.1 = 7.6|.
  \item Subtraction: \lstinline|-|, e.g., \lstinline|5.0 - 2.2 = 2.8|.
  \item Multiplication: \lstinline|*|, e.g.,
    \lstinline|3.0 * 2.5 = 7.5|.
  \item Division: \lstinline|/|, e.g.,
    \lstinline|7.5 / 2.5 = 3.0|. Always a floating-point number, even if the result is an integer.
  \end{itemize}
\end{frame}
\begin{frame}
  \frametitle{Problems}
  Let us work in base 10, with 4 digits of mantissa and 2 digits of
  exponent.
  \begin{itemize}[<+->]
  \item $0.1\cdot 10^{1} * 0.1\cdot 10^{10} = 0.01\cdot 10^{11}=0.1\cdot 10^{10}$
  \item $1.0 + 0.1\cdot 10^{10}$. This is not easy, \pause
    we have to convert
    $$1.0\cdot 10^{0}=0.\underbrace{0000000001}_{10 digits}\cdot
    10^{10}$$\pause
    Now we can add $0.1 + =0.0000000001=0.1000000001$\\
    \pause
    So $1 + 0.1\cdot 10^{10} = 0.1000000001\cdot 10^{10}$\\
    \pause
    But we only have \emph{4 digits of mantissa}
    $$ 0.1000000001\cdot 10^{10} =  0.1000\cdot 10^{10}=
    0.1\cdot 10^{10}$$
    \pause
    Therefore $1 + 0.1\cdot 10^{10}=0.1\cdot 10^{10}$\\
    \pause
    We have lost the precision of the number 1, and we have a \emph{wrong result}.
  \end{itemize}
\end{frame}
\begin{frame}
  \frametitle{Booleans}
  Type \lstinline|bool| has only two values: \lstinline|True| and
  \lstinline|False|.\\ \pause
  \begin{itemize}[<+->]
  \item Booleans are the result of \emph{comparisons} between values, e.g., \lstinline|2 > 3| is
    \lstinline|False|, \lstinline|5 == 5| is \lstinline|True|.
  \item Booleans are used to control the flow of the program, e.g., in
    \lstinline|if| statements and \lstinline|while| loops.
  \end{itemize}
\end{frame}
\begin{frame}
  \frametitle{Bool operations}
  The basic operations on booleans are
  \begin{itemize}[<+->]
  \item Logical AND: \lstinline|and|
  \item Logical OR: \lstinline|or|
  \item Logical NOT: \lstinline|not|
  \end{itemize}

  \begin{center}
    \visible<1->{\begin{tabular}{|c|c|c|}
          \hline
          \lstinline|A| & \lstinline|B| & \lstinline|A and B| \\
          \hline
          \lstinline|True| & \lstinline|True| & \lstinline|True| \\
          \hline
          \lstinline|True| & \lstinline|False| & \lstinline|False| \\
          \hline
          \lstinline|False| & \lstinline|True| & \lstinline|False| \\
          \hline
          \lstinline|False| & \lstinline|False| & \lstinline|False| \\
          \hline
        \end{tabular}
      }
      \visible<2->{\begin{tabular}{|c|c|c|}
          \hline
          \lstinline|A| & \lstinline|B| & \lstinline|A or B| \\
          \hline
          \lstinline|True| & \lstinline|True| & \lstinline|True| \\
          \hline
          \lstinline|True| & \lstinline|False| & \lstinline|True| \\
          \hline
          \lstinline|False| & \lstinline|True| & \lstinline|True| \\
          \hline
          \lstinline|False| & \lstinline|False| & \lstinline|False| \\
          \hline
        \end{tabular}
      }
      \visible<3->{\begin{tabular}{|c|c|}
          \hline
          \lstinline|A| & \lstinline|not A| \\
          \hline
          \lstinline|True| & \lstinline|False| \\
          \hline
          \lstinline|False| & \lstinline|True| \\
          \hline
        \end{tabular}}
  \end{center}
\end{frame}
\begin{frame}
  \frametitle{Comparison operators}
  The basic comparison operators are
  \begin{itemize}[<+->]
  \item Equal: \lstinline|==|
  \item Not equal: \lstinline|!=|
  \item Greater than: \lstinline|>|
  \item Less than: \lstinline|<|
  \item Greater than or equal to: \lstinline|>=|
  \item Less than or equal to: \lstinline|<=|
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Strings}
  \begin{visibleenv}<+->
    A string is a sequence of characters. In Python, strings are
    enclosed in either single quotes (\lstinline|'Hello'|) or double
    quotes (\lstinline|"Hello"|).
  \end{visibleenv}
  The basic operations on strings are
  \begin{itemize}[<+->]
  \item The length of a string: \lstinline|len()|
  \item Indexing: \lstinline|[]|
    \lstinline|Hello[1]| is 'e', \lstinline|Hello[4]| is 'o'.\\
  \item Concatenation: \lstinline|+|
  \end{itemize}
\end{frame}
\begin{frame}[fragile]{Examples}
  \begin{visibleenv}<+->
\begin{lstlisting}
>>> s = 'Hello'
>>> len(s)
5
>>> s[0], s[1], s[2], s[3], s[4]
('H', 'e', 'l', 'l', 'o')
\end{lstlisting}
  \end{visibleenv}
  \begin{visibleenv}<+->
    \textbf{Important:} In Python (and in most computer languages)
    enumerations start at 0.
  \end{visibleenv}
  \begin{visibleenv}<+->
\begin{lstlisting}
>>> name = 'Alice'
>>> greeting = 'Hello, ' + name + '!'
>>> greeting
'Hello, Alice!'
\end{lstlisting}
  \end{visibleenv}
\end{frame}

\begin{frame}
  \frametitle{Characters encodings}
  \visible<+->{Python uses UTF-8 encoding for strings.}

  \begin{block}<+->{ASCII}
    \begin{itemize}
    \item First computers used ASCII enconding (1961)

    \item Only U.S. chars
    \item 1 byte, 1 letter
    \item 8-bit encoding, 7 (bits) for information, 1 bit for
      \emph{parity} check.
    \end{itemize}
  \end{block}
\end{frame}

\begin{frame}
  \frametitle{ASCII table}
  \small
  \url{https://en.wikipedia.org/wiki/ASCII}
  \begin{center}

    \begin{visibleenv}<+->
      \begin{tabular}{|c|c|c|}
        \hline
        011 0000 & 48 & 0\\\hline
        011 0001 & 49 & 1\\\hline
        011 0010 & 50 & 2\\\hline
        011 0011 & 51 & 3\\\hline
        011 0100 & 52 & 4\\\hline
        011 0101 & 52 & 5\\\hline
        011 0110 & 54 & 6\\\hline
        011 0111 & 55 & 7\\\hline
        011 1000 & 56 & 8\\\hline
        011 1001 & 57 & 9\\\hline
      \end{tabular}
    \end{visibleenv}
    \begin{visibleenv}<+->
      \begin{tabular}{|c|c|c|}
        \hline
        100 0001& 65&A\\\hline
        100 0010& 66&B\\\hline
        100 0011& 67&C\\\hline
        100 0100& 68&D\\\hline
        100 0101& 69&E\\\hline
        \multicolumn{3}{|c|}{\dots}\\\hline
        101 0111& 87&V\\\hline
        101 1000& 88&X\\\hline
        101 1001& 89&Y\\\hline
        101 1010& 90&Z\\\hline
      \end{tabular}
    \end{visibleenv}
    \begin{visibleenv}<+->
      \begin{tabular}{|c|c|c|}
        \hline
        110 0001& 97&a\\\hline
        110 0010& 98&b\\\hline
        110 0011& 99&c\\\hline
        110 0100& 100&d\\\hline
        110 0101& 101&e\\\hline
        \multicolumn{3}{|c|}{\dots}\\\hline
        110 0111& 119&v\\\hline
        111 1000& 120&x\\\hline
        111 1001& 121&y\\\hline
        111 1010& 122&z\\\hline
      \end{tabular}
    \end{visibleenv}
  \end{center}
\end{frame}

\begin{frame}
  \frametitle{Other encodings}
  \begin{visibleenv}<+->
    Since other languages have more characters than English, other
    encodings were developed, e.g.,
  \end{visibleenv}
  \begin{description}[<+->]
  \item[ISO-8859-1 (Latin-1)], that can represent characters from
    Western European languages. Up to 15 ISO-8859 charsets. 1 byte, 1 letter.
  \item[windows-1252] Microsoft developed. 1 byte, 1 letter
  \end{description}
  \begin{visibleenv}<+->
    Problems:
    \begin{itemize}[<+->]
    \item Many different incompatible charsets
    \item Many languages have more than 256 letters (1 byte)
    \end{itemize}
  \end{visibleenv}
\end{frame}
\begin{frame}
  \frametitle{Unicode}
  \begin{visibleenv}<+->
    Unicode is a character encoding standard maintained by the Unicode
    Consortium designed to support the use of text in \emph{all of the
      world}'s writing systems that can be digitized.\\
    \url{https://en.wikipedia.org/wiki/Unicode}
  \end{visibleenv}
    \begin{itemize}[<+->]
    \item UTF-8. Most used (Python). Backwards compatible with ASCII.
    \item UTF-16 and UTF-32.
    \end{itemize}
    \begin{visibleenv}<+->
      \textbf{Problem:} Many documents in Internet use old encodings.
    \end{visibleenv}
\end{frame}
\end{document}

%%% Local Variables:
%%% mode: LaTeX1
%%% TeX-master: t
%%% End:
