Getting Around The Book¶
This page will help you learn how to get around this interactive textbook and use the embedded tools.
One of the most important things that you can do when you are learning a programming language is to write programs. Unfortunately, typical textbooks allow you to read about programming but don’t allow you to practice. We have created a unique tool called ActiveCode that allows you to write, modify, and execute programs right in the text itself (right from the web browser). Although this is certainly not the way real programs are written, it provides an excellent environment for learning a programming language like Python since you can experiment with the language as you are reading.
Take a look at the ActiveCode interpreter in action. If we take a simple Python program and make it active, you will see that it can be executed directly by pressing the Run button. Try pressing the Run button below.
The CodeLens Tool¶
In addition to ActiveCode, you can also execute Python code with the assistance of a unique visualization tool. This tool, known as CodeLens, allows you to control the step by step execution of a program. It also lets you see the values of all variables as they are created and modified. The following example shows CodeLens in action on the same simple program as we saw above. Remember that in ActiveCode, the source code executes from beginning to end and you can see the final result. In Codelens you can see and control the step by step progress. Try clicking on the Forward button below.
Finally, it is also possible to embed simple questions into the text. These questions provide a way for you to check yourselves as you go along. The questions also provide feedback so that you can understand why an answer may or may not be correct.
Check your understanding
sc-1-1: What programming language does this site help you to learn?
- (A) Python
- Yes, Python is a great language to learn, whether you are a beginner or an experienced programmer.
- (B) Java
- Java is a good object oriented language but it has some details that make it hard for the beginner.
- (C) C
- C is an imperative programming language that has been around for a long time, but it is not the one that we use.
- (D) ML
- No, ML is a functional programming language. You can use Python to write functional programs as well.
This next type of question allows more than one correct answer to be required. The feedback will tell you whether you have the correct number as well as the feedback for each.
sc-1-2: Which colors might be found in a rainbow? (choose all that are correct)
- (A) red
- Red is a definitely on of the colors.
- (B) yellow
- Yes, yellow is correct.
- (C) black
- Remember the acronym...ROY G BIV. B stands for blue.
- (D) green
- Yes, green is one of the colors.
Check your understanding
sc-1-3: Construct a block of code that correctly implements the accumulator pattern.x = 0 for i in range(10) x = x + 1
Our toolset provides a number of different things that will help you to learn to program in the Python programming language. Aside from reading the text, it is sometimes useful to hear someone tell you about different aspects of the topic being discussed. In order to accomplish this, we provide a way to integrate simple, short videos into the text. For example, if you click on the video shown below, you will hear us talk about the tools that will be described shortly.