Section 7.1 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.
Note that you can control the step by step execution and you can even move forward and backward thru the statements as they execute.Hint 1.
.. codelens:: firstexample :showoutput: print("My first program adds two numbers, 2 and 3:") print(2 + 3)
The following example shows a more sophisticated program using Python lists. The codelens tool draws very useful pictures as the statements are being executed. These pictures, called reference diagrams, are very helpful as you learn about the more complex aspects of Python.Hint 2.
.. codelens:: secondexample fruit = ["apple","orange","banana","cherry"] numlist = [6,7] newlist = fruit + numlist zeros =  * 4 zeros = fruit zeros = numlist