Lesson 11 Arrays Lists
Lesson 11 Arrays Lists
scalable code.
for i in range (0,3): for i in range(1, 10, 2): for i in range(2): ACP
print (i) print(i) for j in range(3): Check
print(i, j)
Question: What will Question: What will Question: What will
this code output? this code output? this code output?
count = 1 x=0 for i in range(5):
while count < 4: while x < 5: if i % 2 == 0:
print(count) print("Looping!") print(i) VAA
Check
count += 1
Question: What will # Add missing line to Question: What will
this code output? avoid an infinite loop this code output?
Success Criteria
Write simple Python programs that use lists to store and display information
Compare and contrast different ways to manipulate lists (e.g., using .sort() vs. sorted()).
Design and implement Python programs that solve complex problems using lists
LO: Critically evaluate and apply lists in Python to solve complex problems, demonstrating the ability to create efficient, scalable code.
for i in range (0,3):10 minutes
for i in range(1, 10, 2):Realisefor
whati you
in range(2):
printRecall
have done previously
(i) print(i) for j in range(3):
print(i, j)
0, 1, 2 1, 3, 5, 7, 9 i=0,j=0 ACP
Check
i=0,j=1
i=0,j=2
i=1,j=0
i=1,j=1
i=1,j=2
VAA
Check
Arrays / Lists
ACP
Check
Success Criteria
• Write simple Python programs that use lists to store and display VAA
information (e.g., grocery list, favorite movies). Check
• What is a List?
• A list in Python is a collection of related items stored together in
a single variable.
VAA
Check
Think Pair Share: Can you think of other examples where you have a collection
of related items? Share your ideas!”
Success Criteria
Write simple Python programs that use lists to store and display information
Compare and contrast different ways to manipulate lists (e.g., using .sort() vs. sorted()).
Design and implement Python programs that solve complex problems using lists
LO: Critically evaluate and apply lists in Python to solve complex problems, demonstrating the ability to create efficient, scalable code.
Connection finding to new learning
Each item in a list is called an element. Elements can be any data VAA
type, like strings, numbers, or even other lists Check
print(“Found!”)
Challenge: How could we change this program so that it
automatically adjusts if we add more items to the list?
Success Criteria
Write simple Python programs that use lists to store and display information
Compare and contrast different ways to manipulate lists (e.g., using .sort() vs. sorted()).
Design and implement Python programs that solve complex problems using lists
LO: Critically evaluate and apply lists in Python to solve complex problems, demonstrating the ability to create efficient, scalable code.
Critically Thinking
• Create a list of your three favourite foods and show the following:
Success Criteria
Write simple Python programs that use lists to store and display information
Compare and contrast different ways to manipulate lists (e.g., using .sort() vs. sorted()).
Design and implement Python programs that solve complex problems using lists
LO: Critically evaluate and apply lists in Python to solve complex problems, demonstrating the ability to create efficient, scalable code.
Hard working time
Activity 1 – Indexing
ACP
Check
Support
Support
ACP
Check
VAA
Check
Success Criteria
Write simple Python programs that use lists to store and display information
Compare and contrast different ways to manipulate lists (e.g., using .sort() vs. sorted()).
Design and implement Python programs that solve complex problems using lists
LO: Critically evaluate and apply lists in Python to solve complex problems, demonstrating the ability to create efficient, scalable code.
Hard working time
• Create a list called grocery_list with six items you need to buy
from the store (e.g., ["milk", "bread", "eggs", "apples", "carrots",
"pasta"]).
• Print the list in its original order.
• Use the .sort() method to sort the list alphabetically, then print it
again. VAA
Check
Activity 3
Hint: Use len(arr) function to find ACP
a) Write a Python program to find the sum Check
the number of items in the list.\
of all the items in the list
Support See slide 11
• Sample Output
[20, 75, 33, 90, 11, 56, 87] Challenge a: Find the average of the
items in the list and display it
Sum of items is 372 alongside the sum.
Activity 3- Solutions
ACP
Check
a) b)
VAA
Check
Success Criteria
Write simple Python programs that use lists to store and display information
Compare and contrast different ways to manipulate lists (e.g., using .sort() vs. sorted()).
Design and implement Python programs that solve complex problems using lists
LO: Critically evaluate and apply lists in Python to solve complex problems, demonstrating the ability to create efficient, scalable code.
Hard working time
Challenge: The Guest List Loop
ACP
Check
Success Criteria
Write simple Python programs that use lists to store and display information
Compare and contrast different ways to manipulate lists (e.g., using .sort() vs. sorted()).
Design and implement Python programs that solve complex problems using lists
LO: Critically evaluate and apply lists in Python to solve complex problems, demonstrating the ability to create efficient, scalable code.
Plenary
ACP
Check
Two Stars:
Think of two things that went well today. This can be:
Something you learned and understood well.
A task or concept that you felt confident about.
A Wish:
VAA
Think of one thing you want to improve or learn more about. Check
Success Criteria
Write simple Python programs that use lists to store and display information
Compare and contrast different ways to manipulate lists (e.g., using .sort() vs. sorted()).
Design and implement Python programs that solve complex problems using lists
LO: Critically evaluate and apply lists in Python to solve complex problems, demonstrating the ability to create efficient, scalable code.
Python.
To use all the functions under this library, you have to import the library
using
VAA
Check
Success Criteria
Write simple Python programs that use lists to store and display information
Compare and contrast different ways to manipulate lists (e.g., using .sort() vs. sorted()).
Design and implement Python programs that solve complex problems using lists
LO: Critically evaluate and apply lists in Python to solve complex problems, demonstrating the ability to create efficient, scalable code.
Exam Question
ACP
Check
VAA
Check
Answer:
Success Criteria
Write simple Python programs that use lists to store and display information
Compare and contrast different ways to manipulate lists (e.g., using .sort() vs. sorted()).
Design and implement Python programs that solve complex problems using lists
LO: Critically evaluate and apply lists in Python to solve complex problems, demonstrating the ability to create efficient, scalable code.
Searching algorithms
ACP
Check
Success Criteria
Write simple Python programs that use lists to store and display information
Compare and contrast different ways to manipulate lists (e.g., using .sort() vs. sorted()).
Design and implement Python programs that solve complex problems using lists
LO: Critically evaluate and apply lists in Python to solve complex problems, demonstrating the ability to create efficient, scalable code.
Next lesson
ACP
Check
VAA
Check
Success Criteria
Write simple Python programs that use lists to store and display information
Compare and contrast different ways to manipulate lists (e.g., using .sort() vs. sorted()).
Design and implement Python programs that solve complex problems using lists
LO: Critically evaluate and apply lists in Python to solve complex problems, demonstrating the ability to create efficient, scalable code.
linearSearch(myItem,myList) TRUE
ELSE
END IF
END FOR
OUTPUT: match
Success Criteria END
Write simple Python programs that use lists to store and display information
Compare and contrast different ways to manipulate lists (e.g., using .sort() vs. sorted()).
Design and implement Python programs that solve complex problems using lists
LO: Critically evaluate and apply lists in Python to solve complex problems, demonstrating the ability to create efficient, scalable code.
Success Criteria
Write simple Python programs that use lists to store and display information
Compare and contrast different ways to manipulate lists (e.g., using .sort() vs. sorted()).
Design and implement Python programs that solve complex problems using lists
LO: Critically evaluate and apply lists in Python to solve complex problems, demonstrating the ability to create efficient, scalable code.
• Write a program that stores the names of five countries and their
capital cities in two different lists. The program should print the name of
the country and its capital city for all five countries.
• Challenge:
Write a Python program to find common items from two lists VAA
Check
• Sample Output
[23,45,67,78,89,34]
[34,89,55,56,39,67]
Common items from two lists : {89, 34, 67}
Success Criteria
Write simple Python programs that use lists to store and display information
Compare and contrast different ways to manipulate lists (e.g., using .sort() vs. sorted()).
Design and implement Python programs that solve complex problems using lists
LO: Critically evaluate and apply lists in Python to solve complex problems, demonstrating the ability to create efficient, scalable code.
Plenary
ACP
Check
• Write a wish about what you want to achieve in the next lesson VAA
Check
or Is there anything you need me to go over again?
Success Criteria
Write simple Python programs that use lists to store and display information
Compare and contrast different ways to manipulate lists (e.g., using .sort() vs. sorted()).
Design and implement Python programs that solve complex problems using lists