Download presentation
Presentation is loading. Please wait.
1
A mini TRACS
2
Variables Table counter = 1 while counter < 4: print("Happy days") counter = counter + 1 print(“End of program”) What is printed?
3
Step 1: Draw round all expressions
Variables Table counter = 1 while counter < 4: print("Happy days") counter = counter + 1 print(“End of program”) What is printed?
4
Step 2: Draw arrows to show the order the statements are executed
Variables Table counter = 1 while counter < 4: print("Happy days") counter = counter + 1 print(“End of program”) FALSE TRUE What is printed?
5
Step 3: Work through the program showing variables and output
Variables Table counter = 1 while counter < 4: print("Happy days") counter = counter + 1 print(“End of program”) counter FALSE TRUE What is printed?
6
Step 3: Work through the program showing variables and output
Variables Table counter = 1 while counter < 4: print("Happy days") counter = counter + 1 print(“End of program”) counter 1 FALSE TRUE What is printed?
7
Step 3: Work through the program showing variables and output
Variables Table counter = 1 while counter < 4: print("Happy days") counter = counter + 1 print(“End of program”) counter 1 FALSE TRUE 1 TRUE What is printed?
8
Step 3: Work through the program showing variables and output
Variables Table counter = 1 while counter < 4: print("Happy days") counter = counter + 1 print(“End of program”) counter counter 1 1 FALSE 2 TRUE What is printed? Happy days Working out area counter = counter + 1 counter = 1 + 1 counter = 2
9
Step 3: Work through the program showing variables and output
Variables Table counter = 1 while counter < 4: print("Happy days") counter = counter + 1 print(“End of program”) counter 1 FALSE TRUE 2 2 TRUE What is printed? Happy days
10
Step 3: Work through the program showing variables and output
Variables Table counter = 1 while counter < 4: print("Happy days") counter = counter + 1 print(“End of program”) counter counter 1 1 FALSE 2 TRUE 3 What is printed? Happy days Happy days Working out area counter = counter + 1 counter = 2 + 1 counter = 3
11
Step 3: Work through the program showing variables and output
Variables Table counter = 1 while counter < 4: print("Happy days") counter = counter + 1 print(“End of program”) counter 1 FALSE TRUE 3 2 TRUE 3 What is printed? Happy days Happy days
12
Step 3: Work through the program showing variables and output
Variables Table counter = 1 while counter < 4: print("Happy days") counter = counter + 1 print(“End of program”) counter counter 1 1 FALSE 2 TRUE 3 4 What is printed? Happy days Happy days Happy days Working out area counter = counter + 1 counter = 3 + 1 counter = 4
13
Step 3: Work through the program showing variables and output
Variables Table counter = 1 while counter < 4: print("Happy days") counter = counter + 1 print(“End of program”) counter counter 1 1 FALSE FALSE 4 2 TRUE 3 4 What is printed? Happy days Happy days Happy days
14
Step 3: Work through the program showing variables and output
Variables Table counter = 1 while counter < 4: print("Happy days") counter = counter + 1 print(“End of program”) counter counter 1 1 FALSE FALSE 2 TRUE 3 4 What is printed? Happy days Happy days Happy days End of program
15
Now for another example
16
What is printed? (Output)
Variables Table def input_name(): name = input("What is your name? ") counter = 1 while counter <= 4: print("Hello" + name) counter = counter + 1 print("Goodbye "+ name) What is printed? (Output) Working out area 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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.