Page 90 - Information_Practice_Fliipbook_Class11
P. 90
To start visualization, we click the <Next> button. On executing the 1st line of code, Python creates the list lst1
comprising values 30, 60, 10, 20, and 50 (Fig 4.12). The execution environment of the Python script is called a global
frame. So, the visualisation shows the list lst1 in the global frame. The left panel of the code box shows two arrows
colored in red and green respectively. While the green arrow refers to the line just executed, the red arrow points to
the next line to be executed.
Fig 4.12: Code Visualization through Python Tutor (after execution of line 1)
As the red arrow points to line 2, clicking <Next> executes line 2. Now each of the two names (variables) lst1 and
lst2 refers to the same list (Fig 4.13). Note that the global frame now contains two entries, one for name lst1 and
another for lst2.
Fig 4.13: Code Visualization through Python Tutor (after execution of line 2)
Clicking <Next> executes line 3 of the code, and Python displays the list lst1 and id(lst1)in the Print
output box. Again, clicking <Next> executes line 4 of the code, and Python displays the list lst2 and id(lst2) in
the Print output box. Note that id(lst1) equals id(lst2), again confirming that the names lst1 and lst2 refer
to the same list (Fig 4.14).
76 Touchpad Informatics Practices-XI

