﻿<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xml" href="/cjs/examples.screen.xsl" media="screen"?>
<examples chapter="Generátory a iterátory" directory="iteratory">

<!--
  <example>
    <text>
    </text>
    <hint>
    </hint>
    <solution src="iteratory/.py" lang="python" />
  </example>
-->


  <example>
    <text>
        Napište (konečný) generátor pro průchod po prvcích řetězce (aneb vlastně zduplikujte funkcionalitu, která je v Python'u automaticky přítomná v rámci smyčky <em>for-in</em> nad řetězci).
    </text>
    <hint>
        Podívejte se do přednášek…
    </hint>
    <solution src="iteratory/01g.py" lang="python" />
  </example>

  <example>
    <text>
        Přepište řešení předchozí úlohy z generátoru na iterátor.
    </text>
    <hint>
        Nezapomeňte, že tento iterátor musí být konečný. A jinak se podívejte do přednášek…
    </hint>
    <solution src="iteratory/01i.py" lang="python" />
  </example>

  <example>
    <text>
        Napište (nekonečný) generátor vracející postupně všechna lichá čísla v řadě <code>1, 3, 5…</code>
    </text>
    <hint>
        Podívejte se do přednášek…
    </hint>
    <solution src="iteratory/02g.py" lang="python" />
  </example>

  <example>
    <text>
        Přepište řešení předchozí úlohy z generátoru na iterátor.
    </text>
    <hint>
        Tento iterátor je pochopitelně nekonečný. A jinak se podívejte do přednášek…
    </hint>
    <solution src="iteratory/02i.py" lang="python" />
  </example>

  <example>
    <text>
        Napište generátor pro výpis vlastností objektu, tj. napište generátor, který projde výpis volání funkce <em>dir</em> na příslušný objekt.
    </text>
    <hint>
        Funkce <em>dir()</em> vrací vlastnosti objektu jako seznam řetězců. Pochopitelně konečný. PS: Není náhodou už sám seznam iterátorem?
    </hint>
    <solution src="iteratory/03g.py" lang="python" />
  </example>

  <example>
    <text>
        Přepište řešení předchozí úlohy z generátoru na iterátor.
    </text>
    <hint>
        Nezapomeňte, že tento iterátor musí být konečný.
    </hint>
    <solution src="iteratory/03i.py" lang="python" />
  </example>

<!--
  <example>
    <text>
    </text>
    <hint>
    </hint>
    <solution src="iteratory/04g.py" lang="python" />
  </example>

  <example>
    <text>
        Přepište řešení předchozí úlohy z generátoru na iterátor.
    </text>
    <hint>
    </hint>
    <solution src="iteratory/04i.py" lang="python" />
  </example>
-->


</examples>
