Title: LOOPS (REPEAT..UNTIL,WHILE..DO..ENDWHILE) BY the end of the lesson You will be able to understand the concept and use of REPEAT..UNTIL,WHILE..DO.. ENDWHILE loops Lesson goals/Learning outcomes: Understand what is the use of loops. Difference between REPEAT .. UNTIL and WHILE ..DO.. ENDWHILE loop. Which loop to be used in a certain scenario. Starter/ Do Now activity/ Warmer Slide no -2 Scaffolder practice ( You do) Schoology Instruction and Modelling (I do/We do) Slide 4-11 Lesson at a glance Vocabulary : – Iteration, Post-condition, Pre-condition Checking for understanding Slide 14 Plenary/Exit Ticket Slide 15 Extension Task/ Challange Slide 12
Starter Write a program using pseudocode to calculate and output the total of 10 numbers entered by the user.
Key Words ITERATION POST-CONDITION PRE-CONDITION 3
REPEAT... UNTIL... A repetition, where the number of repeats is not known, that is completed at least once REPEAT OUTPUT "Hello" INPUT Option Until Option = -1
REPEAT... UNTIL... A repetition, where the number of repeats is not known, that is completed at least once REPEAT OUTPUT "Hello" INPUT Option Until Option = -1 Condition to determine whether we want to continue our program
What does the code below do? REPEAT... UNTIL... Total ← 0 Mark ← 0 REPEAT Total ← Total + Mark OUTPUT "Enter value for mark, -1 to finish " INPUT Mark UNTIL Mark = -1
Answer: In each iteration, ask the user for a mark. The mark given will be added to the total. The program stops when the user enter the value -1. REPEAT... UNTIL... Total ← 0 Mark ← 0 REPEAT Total ← Total + Mark OUTPUT "Enter value for mark, -1 to finish" INPUT Mark UNTIL Mark = -1 A repetition, where the number of repeats is not known, that is completed at least once
WHILE... DO... ENDWHILE A repetition, where the number of repeats is not known, that may never be completed Total ← 0 OUTPUT "Enter value for mark, -1 to finish " INPUT Mark WHILE Mark <> -1 DO Total ← Total + Mark OUTPUT "Enter value for mark, -1 to finish" INPUT Mark ENDWHILE
Total ← 0 OUTPUT "Enter value for mark, -1 to finish " INPUT Mark WHILE Mark <> -1 DO Total ← Total + Mark OUTPUT "Enter value for mark, -1 to finish" INPUT Mark ENDWHILE WHILE... DO... ENDWHILE Signify the end of the while loop. Condition to decide whether the DO block will be run Block that will be executed by the DO keyword
10 Key Words/ Terms: ( WE DO)
11 Key Words/ Terms: ( WE DO ) MS
12 CHALLENGE QUESTION ( YOU DO ) 2 Lessons required:
Open schoology. Go to week 7 and solve the worksheet Independent practice
Checking for Understanding Completion of worksheet which include Past paper questions would be given to assess students understanding . A question would be asked to each student at the end of the lesson to check students understanding
Exit Ticket: Know more remember more Difference between REPEAT…UNTILL and WHILE…DO…ENDWHILE