Chapters 1 & 2
Lesson Objectives
- use while loops successfully with Python
Starter
Main
Computers are great at repeating tasks, and they can do them REALLY quickly! A while loop will repeatedly run program code while something is true.
Red Task
Type the following in to Python.
Q1. What do you notice about the output?
Q2. Why is using a while loop better?
~~~Evidence~~~
1. Write your own short program using BOTH of the methods above
- print them, stick them in your book and write a note to explain which is best and why
Orange Task
Copy the following explanation into your book:
Q3. In your book explain how = is different to == in Python
Structure of a while loop |
Try typing in the following code:
Can you write a while loop using one of the following operators?
- eg while the number is less than 10 print "this number is below 10,"
- eg while the number is greater than 10 print " this number is greater than 10"
Q3. In your book explain how = is different to == in Python
~~~Evidence~~~
1. Write 3 short programs of your own that use a while loop
- try to use 3 different operators from the table above
- print them, stick them in your book and write a note to explain each one
- print them, stick them in your book and write a note to explain each one
Green Task
Write a program that will print the Times Table up to 12
Extension
can you write it as a Function named - def Tables
Blog Post (to finish for hwk)
Add the following notes/code snippets to your blog entitled
'Using a while loop'
Plenary
Write a program that will print the Times Table up to 12
Extension
can you write it as a Function named - def Tables
Blog Post (to finish for hwk)
Add the following notes/code snippets to your blog entitled
'Using a while loop'
Further reading - http://learnpythonthehardway.org/book/ex33.html
No comments:
Post a Comment