
Lists
Presentation
•
Computers
•
9th - 12th Grade
•
Medium
N Ellis
Used 2+ times
FREE Resource
21 Slides • 11 Questions
1
Data structures: Arrays (Lists) and records
2
3
4
5
6
7
8
9
10
11
12
For those of you who program in Python:
Python doesn’t have arrays – it has lists!
In theory, they are NOT the same!
You must be aware of this for your exam!
An ‘Array’ is collection of data WHICH HAS THE SAME DATA TYPE.
An ‘Array’ uses a STATIC AREA OF MEMORY and therefore we need to STATE HOW BIG THE ARRAY NEEDS TO BE and WHAT TYPE OF DATA IT WILL HOLD before data is added to it. An array therefore CANNOT GROW OVERTIME– you CAN’T APPEND DATA to it!
13
For those of you who program in Python:
Python doesn’t have arrays – it has lists!
In theory, they are NOT the same!
You must be aware of this for your exam!
A ‘List’ on the other hand can contain data which DOESN’T HAVE TO BE OF THE SAME DATA TYPE.
A ‘List’ uses memory DYNAMICALLY, which means that it uses different areas of memory if it needs to and as a result CAN GROW– DATA CAN BE APPENDED (added) to it!
14
15
16
17
18
19
20
21
Records
As we learnt earlier, arrays can only store data of the same type. For example, an array may store only string data, or integer data, but it cannot contain a mix of data types.
Records however, are a data structure that allows different types of data to be stored together.
This would be really useful when storing data about a person, such as a person’s name (string), age (integer) and whether or not they liked Marmite (Boolean).
22
Multiple Choice
Which of these is the correct code for creating a list of names?
nameList = John, Harry, Jesse, John, Harry, Harry
nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList = [John, Harry, Jesse, John, Harry, Harry]
23
Multiple Choice
List items have an index number. In the following list, which item has the index number of 3?
["Joe", "Harry", "Jesse", "John", "Harry", "Harry"]
"John"
"Harry"
"Jesse"
"John"
24
Multiple Choice
Which of these pieces of code would return the name "Harry" from the following list?
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList()
nameList[1]
NameList(4)
nameList["4"]
25
Multiple Choice
The list needs one more name added to the end - "Felipe". Which piece of code below would do this?
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList.append(Felipe)
append(nameList,"Felipe")
nameList.append["Felipe",7]
nameList.append("Felipe")
26
Multiple Choice
27
Multiple Choice
28
Multiple Choice
Is this the correct code for a list?
register = {"Sam", "Pheobe", Georgia", Richard"}
Yes
No
29
Multiple Choice
To print a list called fruitList we use
print(fruitList)
list(print)
fruitList.print()
fruitList(print)
30
Multiple Choice
Which colour will be replaced with yellow?
red
green
blue
none, yellow will be added to the list
31
Multiple Choice
Which symbols are used to open and close a list?
( ) round brackets
( ) curly brackets
[ ] square brackets
" " speech marks
32
Multiple Choice
Consider the list:
myList=["red", "orange", "yellow"]
What would the following statement print?
print(myList[2])
This is a value Index Error
yellow
orange
red
Data structures: Arrays (Lists) and records
Show answer
Auto Play
Slide 1 / 32
SLIDE
Similar Resources on Wayground
25 questions
2.5 Storage
Presentation
•
9th - 12th Grade
23 questions
En la escuela
Presentation
•
9th - 12th Grade
23 questions
Formal Vs. Informal
Presentation
•
9th - 12th Grade
22 questions
Databases and SQL
Presentation
•
10th - 12th Grade
24 questions
Binary numbers
Presentation
•
9th - 12th Grade
25 questions
HTML Forms
Presentation
•
9th - 12th Grade
26 questions
Networking Basics (ITF+ v2 6.2)
Presentation
•
9th - 12th Grade
24 questions
Expository Writing Introduction
Presentation
•
9th - 12th Grade
Popular Resources on Wayground
20 questions
"What is the question asking??" Grades 3-5
Quiz
•
1st - 5th Grade
20 questions
“What is the question asking??” Grades 6-8
Quiz
•
6th - 8th Grade
10 questions
Fire Safety Quiz
Quiz
•
12th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
34 questions
STAAR Review 6th - 8th grade Reading Part 1
Quiz
•
6th - 8th Grade
20 questions
“What is the question asking??” English I-II
Quiz
•
9th - 12th Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
47 questions
8th Grade Reading STAAR Ultimate Review!
Quiz
•
8th Grade
Discover more resources for Computers
10 questions
Fire Safety Quiz
Quiz
•
12th Grade
20 questions
“What is the question asking??” English I-II
Quiz
•
9th - 12th Grade
10 questions
Fire Prevention
Quiz
•
9th - 12th Grade
24 questions
BIOLOGY STAAR REVIEW
Quiz
•
9th Grade
50 questions
STAAR English 2 Review
Quiz
•
10th Grade
20 questions
Graphing Inequalities on a Number Line
Quiz
•
6th - 9th Grade
20 questions
Figurative Language Review
Quiz
•
10th Grade
30 questions
English 1 STAAR Review
Quiz
•
9th Grade