Page 174 - Computer Science V2.0 Class 11
P. 174

Fig 7.12: Code Visualization through Python Tutor

              To  start  visualization,  we  click  the  <Next>  icon.  On  executing  the  1st  line  of  code,  Python  creates  the  list  lst1
              comprising values 30, 60, 10, 20, and 50 (Fig 7.13). The execution environment of Python script is called 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, red arrow points to the next line
              to be executed.






















                                    Fig 7.13: 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 7.14). Note that the global frame now contains two entries, one for name lst1 and
              another for lst2.






















                                    Fig 7.14: Code Visualization through Python Tutor (after execution of line 2)

               160   Touchpad Computer Science (Ver. 2.0)-XI
   169   170   171   172   173   174   175   176   177   178   179