Lesson Objectives
- learn the structure of lists
- understand indexing in lists
- create a program using lists
Starter
Knowing how to write a list in Python is very useful and if you use the correct conventions Python will instantly recognise your list as a list.
Red Task
Create a list to hold members of your family. Then use the print() function to print out their names as shown.
~~~Evidence~~~
1. Create a program that will print out members of your family, using a list as reference.
- print it, stick it in your book and write a note to explain the structure of the list
Orange Task
~~~Evidence~~~
2. Write a program using a second list
- print it, stick it in your book and write a note to explain what you've done
Green Task
Do some research on List Attributes, in particular:
1. length - len()
2. count list - count()
3. add to - append()
4. delete - remove()
5.sort - sort()
Use the code below to help you create your own list attributes - try at least 3 of the 5 given
Blog Post (to finish for hwk)
Add the following notes/code snippets to your blog entitled
'The structure of a list'
Plenary
Do some research on List Attributes, in particular:
1. length - len()
2. count list - count()
3. add to - append()
4. delete - remove()
5.sort - sort()
Use the code below to help you create your own list attributes - try at least 3 of the 5 given
~~~Evidence~~~
3. Write a program that counts the number of elements in a list as well as the length of the list.
4. Write a program that adds something to a list and removes something from a list
4. Write a program that adds something to a list and removes something from a list
- print both, stick them in your book and write a note to explain what you've done
Blog Post (to finish for hwk)
Add the following notes/code snippets to your blog entitled
'The structure of a list'
Further reading:
- http://learnpythonthehardway.org/book/ex32.html
Homeowrk
Spend at leasst 30 minutes working on Code Academy - http://www.codecademy.com/learn
No comments:
Post a Comment