Understanding a.mini.TRACS Program Execution
Explore the program execution of a.mini.TRACS through step-by-step analysis, including variable values and output at each stage. Witness how the program progresses and learn the sequence of statements executed. Follow the journey of the counter variable and discover what is printed at each iteration.
Download Presentation
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
Variables Table counter = 1 while counter < 4: print("Happy days") What is printed? counter = counter + 1 print( End of program )
Variables Table Step 1: Draw round all expressions counter = 1 while counter < 4: print("Happy days") What is printed? counter = counter + 1 print( End of program )
Step 2: Draw arrows to show the order the statements are executed Variables Table counter = 1 FALSE while counter < 4: TRUE print("Happy days") What is printed? counter = counter + 1 print( End of program )
Step 3: Work through the program showing variables and output Variables Table counter counter = 1 FALSE while counter < 4: TRUE print("Happy days") What is printed? counter = counter + 1 print( End of program )
Step 3: Work through the program showing variables and output Variables Table counter counter = 1 while counter < 4: 1 FALSE TRUE print("Happy days") What is printed? counter = counter + 1 print( End of program )
Step 3: Work through the program showing variables and output Variables Table counter counter = 1 1 FALSE TRUE while counter < 4: 1 TRUE print("Happy days") What is printed? counter = counter + 1 print( End of program )
Step 3: Work through the program showing variables and output Variables Table counter counter counter = 1 1 1 FALSE while counter < 4: 2 TRUE print("Happy days") What is printed? counter = counter + 1 Happy days print( End of program ) Working out area counter = counter + 1 counter = 1 + 1 counter = 2
Step 3: Work through the program showing variables and output Variables Table counter = 1 counter 1 FALSE TRUE while counter < 4: 2 2 TRUE print("Happy days") What is printed? counter = counter + 1 Happy days print( End of program )
Step 3: Work through the program showing variables and output Variables Table counter counter counter = 1 1 1 FALSE while counter < 4: 2 TRUE 3 print("Happy days") What is printed? counter = counter + 1 Happy days print( End of program ) Happy days Working out area counter = counter + 1 counter = 2 + 1 counter = 3
Step 3: Work through the program showing variables and output Variables Table counter counter = 1 1 FALSE TRUE while counter < 4: 3 2 3 TRUE print("Happy days") What is printed? counter = counter + 1 Happy days print( End of program ) Happy days
Step 3: Work through the program showing variables and output Variables Table counter counter counter = 1 1 1 FALSE while counter < 4: 2 TRUE 3 print("Happy days") 4 What is printed? counter = counter + 1 Happy days print( End of program ) Happy days Happy days Working out area counter = counter + 1 counter = 3 + 1 counter = 4
Step 3: Work through the program showing variables and output Variables Table counter counter counter = 1 1 1 FALSE FALSE while counter < 4: 4 2 TRUE 3 print("Happy days") 4 What is printed? counter = counter + 1 Happy days Happy days print( End of program ) Happy days
Step 3: Work through the program showing variables and output Variables Table counter counter counter = 1 1 1 FALSE FALSE while counter < 4: 2 TRUE 3 print("Happy days") 4 What is printed? counter = counter + 1 Happy days print( End of program ) Happy days Happy days End of program
Variables Table def input_name(): name = input("What is your name? ") counter = 1 What is printed? (Output) while counter <= 4: print("Hello" + name) Working out area counter = counter + 1 print("Goodbye "+ name) Step 1: Draw round all expressions Step 2: Draw arrows showing the order in which the statements will be executed Step 3: Work through the program filling in the variables table and the Output box