Page 157 - Computer Science Class 11 Without Functions
P. 157

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)


                                                                                        Data Types and Operators  155
   152   153   154   155   156   157   158   159   160   161   162