Python programs are made interactive in HTML, on request.
A C program will only be interactive if hosted on a Runestone server.
A Java program will only be interactive if hosted on a Runestone server.
A <program> is not interactive, by default, no matter where it is hosted.
An Octave program will only be interactive if hosted on a Runestone server. Octave is meant to be a drop-in replacement for Matlab.
A language not supported by Runestone Services will be rendered static.
The following Python program is in a <listing> since we will want to reference it shortly. The program does not do very much, it just defines four variables whose values are lists of statistics. It should run, and there will be no syntax errors, but it is a bit boring since there is no output.
Now a programming exercise. The program upcoming is going to include all the code of the program preceding. This is accomplished with an @include attribute on the including program whose value is the @xml:id of the included program. So by running the next program, it should pass all of its three tests (for example another example using unit tests, see Checkpoint 3.3.4). Now reload the page, do not run the program in the listing, and then see that the program in the exercise still runs correctly.
You’ll see nothing that tells the reader that the one chunk of code is prefacing the other. And in static formats it might be even less obvious. So you will want to say something to alert the reader. Here it is easy: Checkpoint 3.1.9 includes all the code from Listing 3.1.8.
Checkpoint3.1.9.A Python program, including another.
Compute the total amount of money loaned and store it in the variable loan_total.
Exact same exercise again, but now we include two programs. We first get the simple “Hello, world!” program at Listing 3.1.1 and then the same program defining the variables with lists of statistics at Listing 3.1.8. So the output just includes the extra result from the print() statement.
Checkpoint3.1.10.A Python program, including two others.