A mini TRACS.

Slides:



Advertisements
Similar presentations
Programming In C++ Spring Semester 2013 Lecture 3 Programming In C++, Lecture 3 By Umer Rana.
Advertisements

1 Chapter 4 The while loop and boolean operators Samuel Marateck ©2010.
How SAS implements structured programming constructs
Do-while Loops Programming. COMP102 Prog Fundamentals I: do-while Loops /Slide 2 The do-while Statement l Syntax do action while (condition) l How it.
The "if structure" is used to execute statement(s) only if the given condition is satisfied.
Python Mini-Course University of Oklahoma Department of Psychology Day 2 – Lesson 8 Fruitful Functions 05/02/09 Python Mini-Course: Day 2 - Lesson 8 1.
Equations and Their Solutions
True BASIC Ch. 6 Practice Questions. What is the output? PRINT X LET X = -1 PRINT X FOR X = 4 TO 5 STEP 2 PRINT X NEXT X PRINT X END.
A loop is a repetition control structure. it causes a single statement or block to be executed repeatedly What is a loop?
Loops Chapter 4. It repeats a set of statements while a condition is true. while (condition) { execute these statements; } “while” structures.
1 Python Chapter 4 Branching statements and loops © Samuel Marateck 2010.
Solving Inequalities.
Functions. A function is a relation that has exactly one output for each input.
While Loops CMSC 201. Overview Today we will learn about: Looping Structures While loops.
Graphing Inequalities in Two Variables ALGEBRA 1 UNIT 6: INEQUALITIES.
Lesson 6-3B Objective: Solve inequalities using more than one step…continued.
Simple Control Structures IF, IF-ELSE statements in C.
Quiz Answers 1. Show the output from the following code fragment: int a = 5, b = 2, c = 3; cout
Semester 1 Final Review Lesson 1.1 Variables in Algebra Evaluate the variable expression when x = x.
TABLES AND VALUES Section 1.5. Open Sentence Equation.
Repetition Structures Repetition Structures allow you to write programs that will repeat program steps multiple times. –Also called Loops –Counter controlled.
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
Topic: Control Statements. Recap of Sequence Control Structure Write a program that accepts the basic salary and allowance amount for an employee and.
The If Statement There are no switch statements in Python. You need to use just if statements. There are no switch statements in Python. You need to use.
Conditionals Conditional statements, called conditionals for short, are statements in the if-then or if-then-else form. Examples: “If the alarm goes off,
Learning Objective To be able to… Understand flow chart symbols Complete and correct flow chart algorithms Create a program based on a flow chart.
Loops CMSC 201. Overview Today we will learn about: Looping Structures While loops For Loops.
Algebra 1 Foundations, pg 150 Focus Question How do you write inequalities?  You can use the symbol ______________ to compare two expressions.  Students.
Dynamic White-Box Testing What is code coverage? What are the different types of code coverage? How to derive test cases from control flows?
 Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do.
Exercise 2 : Using for loop Repetition (loop) (1)control variable initialization (2)Test Conditon (3)Modification of control variable value order : (1)
Follow up from lab See Magic8Ball.java Issues that you ran into.
More about Iteration Victor Norman CS104. Reading Quiz.

Constructing a break-even graph: Brian’s Burgers
Chapter 9 Repetition.
Graphing Inequalities
1-5 Equations Goals: Solve equations with one variable
Chapter 2.3 Binary Logic.
Printing Lines of Asterisks
Numbering System TODAY AND TOMORROW 11th Edition
ALGORITHMS & FLOWCHARTING II
While Loops Chapter 3.
3rd prep. – 2nd Term MOE Book Questions.
Chapter 5 Repetition.
6-2 Solving Systems using Substitution
OPERATORS (2) CSC 111.
ICS 3U Tuesday, September 21st.
Chapter 9 Control Structures.
Lecture Notes – Week 3 Lecture-2
Chapter (3) - Looping Questions.
Variables Table counter = 1 while counter < 4: print("Happy days") counter = counter + 1 print(“End of program”) What is printed?
Solving Equations with Variables on Both Sides Day 2
Practice with loops! What is the output of each function below?
Looping Topic 4.
What does this do? def revList(L): if len(L) < = 1: return L x = L[0] LR = revList(L[1:]) return LR + x.
Conditional and iterative statements
Find the reference angle for the angle measuring {image}
Whitebox Testing.
SECTION 2-4 : SOLVING EQUATIONS WITH THE VARIABLE ON BOTH SIDES
Understanding Conditions
Relational Operators.
Nate Brunelle Today: Conditional Decision Statements
PROGRAM FLOWCHART Iteration Statements.
Problem Input a number and print its table using while loop. In the end print Good Bye only once.
Python While Loops.
Solving Equations with Variables on Both Sides Day 2
True or False True or False
Lecture 23 – Practice Exercises 5
Lesson 3.3 Writing functions.
Presentation transcript:

A mini TRACS

Variables Table counter = 1 while counter < 4: print("Happy days") counter = counter + 1 print(“End of program”) What is printed?

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?

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?

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?

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?

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?

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

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

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

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

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

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

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

Now for another example

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