Skip to main content
Logo image

Section 17 Interactive Coding

View Source for section
<section xml:id="section-interactive-code">
    <title>Interactive Coding</title>
    <introduction>
      <p>
        More interactive components, just for testing, no commentary.
      </p>
    </introduction>
    <exercises>
      <title>ActiveCode</title>
      <introduction>
        <p>
          ActiveCode, Python program.
        </p>
      </introduction>
<listing xml:id="program-activecode-python">
<caption>An interactive Python program, using <pubtitle>Runestone</pubtitle></caption>
<program xml:id="python-hello-world" label="python-hello-world" interactive="activecode" language="python">
<code>
print("Hello, World!")
</code>
</program>
</listing>
<listing xml:id="program-activecode-python-no-codelens">
<caption>An interactive Python program without codelens.</caption>
<program xml:id="python-hello-world-no-codelens" label="python-hello-world-no-codelens" interactive="activecode" language="python" codelens="no">
<code>
print("Hello, World!")
</code>
</program>
</listing>
    </exercises>
    <exercises>
      <title>CodeLens</title>
      <introduction>
        <p>
          A steppable Python program.
        </p>
      </introduction>
<listing xml:id="program-codelens-python">
<caption>A Python program, stepable with CodeLens</caption>
<program xml:id="python-hello-world-code-lens" label="python-hello-world-code-lens" interactive="codelens" language="python">
<code>
print('Hello, World!')
</code>
</program>
</listing>
    </exercises>
    <exercises>
      <title>Activity with An ActiveCode</title>
      <introduction>
        <p>
          Something to do with ActiveCode program.
        </p>
      </introduction>
      <activity xml:id="coding-exercise-partial-two" label="coding-exercise-partial-two">
        <title>Activity Coding Exercise</title>
        <statement>
          <p>
            Similar to above,
            but now as a complete Python program inside an <tag>activity</tag>.
            This demonstrates the possibility to use any
            <q>project-like</q>
            block (<tag>project</tag>,
            <tag>activity</tag>, <tag>exploration</tag>,
            <tag>investigation</tag>),
            but not in the case when structured with <tag>task</tag>.
          </p>
        </statement>
<program label="partial-program-two" interactive="activecode" language="python">
<code>
for i in range(10):
print(i)
</code>
</program>
        <answer>
          <p>
            We're still not really sure.
          </p>
        </answer>
      </activity>
    </exercises>
    <subsection>
      <title>YouTube</title>
      <p>
        Video, observable on a Runestone server.
      </p>
      <video xml:id="yt-list-vars" youtube="X1-UNHUajfk" width="60%" margins="5% 35%" preview="yt-list-variables.png" />
    </subsection>
  </section>
More interactive components, just for testing, no commentary.

Exercises 17.1 ActiveCode

View Source for exercises
<exercises>
      <title>ActiveCode</title>
      <introduction>
        <p>
          ActiveCode, Python program.
        </p>
      </introduction>
<listing xml:id="program-activecode-python">
<caption>An interactive Python program, using <pubtitle>Runestone</pubtitle></caption>
<program xml:id="python-hello-world" label="python-hello-world" interactive="activecode" language="python">
<code>
print("Hello, World!")
</code>
</program>
</listing>
<listing xml:id="program-activecode-python-no-codelens">
<caption>An interactive Python program without codelens.</caption>
<program xml:id="python-hello-world-no-codelens" label="python-hello-world-no-codelens" interactive="activecode" language="python" codelens="no">
<code>
print("Hello, World!")
</code>
</program>
</listing>
    </exercises>
ActiveCode, Python program.
View Source for listing
<listing xml:id="program-activecode-python">
<caption>An interactive Python program, using <pubtitle>Runestone</pubtitle></caption>
<program xml:id="python-hello-world" label="python-hello-world" interactive="activecode" language="python">
<code>
print("Hello, World!")
</code>
</program>
</listing>
View Source for program
<program xml:id="python-hello-world" label="python-hello-world" interactive="activecode" language="python">
<code>
print("Hello, World!")
</code>
</program>
Listing 17.1. An interactive Python program, using Runestone
View Source for listing
<listing xml:id="program-activecode-python-no-codelens">
<caption>An interactive Python program without codelens.</caption>
<program xml:id="python-hello-world-no-codelens" label="python-hello-world-no-codelens" interactive="activecode" language="python" codelens="no">
<code>
print("Hello, World!")
</code>
</program>
</listing>
View Source for program
<program xml:id="python-hello-world-no-codelens" label="python-hello-world-no-codelens" interactive="activecode" language="python" codelens="no">
<code>
print("Hello, World!")
</code>
</program>
Listing 17.2. An interactive Python program without codelens.

Exercises 17.2 CodeLens

View Source for exercises
<exercises>
      <title>CodeLens</title>
      <introduction>
        <p>
          A steppable Python program.
        </p>
      </introduction>
<listing xml:id="program-codelens-python">
<caption>A Python program, stepable with CodeLens</caption>
<program xml:id="python-hello-world-code-lens" label="python-hello-world-code-lens" interactive="codelens" language="python">
<code>
print('Hello, World!')
</code>
</program>
</listing>
    </exercises>
A steppable Python program.
View Source for listing
<listing xml:id="program-codelens-python">
<caption>A Python program, stepable with CodeLens</caption>
<program xml:id="python-hello-world-code-lens" label="python-hello-world-code-lens" interactive="codelens" language="python">
<code>
print('Hello, World!')
</code>
</program>
</listing>
View Source for program
<program xml:id="python-hello-world-code-lens" label="python-hello-world-code-lens" interactive="codelens" language="python">
<code>
print('Hello, World!')
</code>
</program>
Listing 17.3. A Python program, stepable with CodeLens

Exercises 17.3 Activity with An ActiveCode

View Source for exercises
<exercises>
      <title>Activity with An ActiveCode</title>
      <introduction>
        <p>
          Something to do with ActiveCode program.
        </p>
      </introduction>
      <activity xml:id="coding-exercise-partial-two" label="coding-exercise-partial-two">
        <title>Activity Coding Exercise</title>
        <statement>
          <p>
            Similar to above,
            but now as a complete Python program inside an <tag>activity</tag>.
            This demonstrates the possibility to use any
            <q>project-like</q>
            block (<tag>project</tag>,
            <tag>activity</tag>, <tag>exploration</tag>,
            <tag>investigation</tag>),
            but not in the case when structured with <tag>task</tag>.
          </p>
        </statement>
<program label="partial-program-two" interactive="activecode" language="python">
<code>
for i in range(10):
print(i)
</code>
</program>
        <answer>
          <p>
            We're still not really sure.
          </p>
        </answer>
      </activity>
    </exercises>
Something to do with ActiveCode program.

Activity 17.1. Activity Coding Exercise.

View Source for activity
<activity xml:id="coding-exercise-partial-two" label="coding-exercise-partial-two">
        <title>Activity Coding Exercise</title>
        <statement>
          <p>
            Similar to above,
            but now as a complete Python program inside an <tag>activity</tag>.
            This demonstrates the possibility to use any
            <q>project-like</q>
            block (<tag>project</tag>,
            <tag>activity</tag>, <tag>exploration</tag>,
            <tag>investigation</tag>),
            but not in the case when structured with <tag>task</tag>.
          </p>
        </statement>
<program label="partial-program-two" interactive="activecode" language="python">
<code>
for i in range(10):
print(i)
</code>
</program>
        <answer>
          <p>
            We're still not really sure.
          </p>
        </answer>
      </activity>
Similar to above, but now as a complete Python program inside an <activity>. This demonstrates the possibility to use any “project-like” block (<project>, <activity>, <exploration>, <investigation>), but not in the case when structured with <task>.
Answer.
View Source for answer
<answer>
  <p>
    We're still not really sure.
  </p>
</answer>
We’re still not really sure.

Subsection 17.4 YouTube

View Source for subsection
<subsection>
  <title>YouTube</title>
  <p>
    Video, observable on a Runestone server.
  </p>
  <video xml:id="yt-list-vars" youtube="X1-UNHUajfk" width="60%" margins="5% 35%" preview="yt-list-variables.png" />
</subsection>
Video, observable on a Runestone server.
Video cover image