Introducing
Your new presentation assistant.
Refine, enhance, and tailor your content, source relevant images, and edit visuals quicker than ever before.
Trending searches
For loops are used when we DO know how many times we want the block of code to repeat
If we wanted to print out the numbers 1-10 we could do the following:
print ("1")
print ("2")
.....
You can add a second 'argument' by separating the values with a comma.
A much easier and efficient way would be to use a for loop
When you played the guessing game, did you know how many guesses your partner would take to get the right answer?
Lesson Objectives:
"A sequence of instructions that is continually repeated until a certain condition is reached."
In pairs I want you to play the number guessing game.
A while() loop works like an if() statement that repeats. Like an if() statement, you need a rule.
I want to print the numbers up to 10. Will the following code work?
Imagine asking for 1p per week pocket money. The deal is that it will double each week so in week 2 you get 2p, in week 3 you get 4p etc.
If I want to print the numbers 10 - 37, what arguments should I set the for loop to?
This might sound a bit rubbish, but complete worksheet 3 and you may be better off than you think
Complete the plenary activity.
Worksheet 4 - loops