
Listing in python
Presentation
•
Computers
•
9th Grade
•
Medium
Boazi Tarmo
Used 1+ times
FREE Resource
10 Slides • 18 Questions
1
LESSON 2: PYTHON LIST
How do we use list in python??
2
List
Lists are used to store multiple items in a single variable.
Lists are created using square brackets
thislist = ["apple", "banana", "cherry"]
print(thislist)
note:
List items are indexed, the first item has index [0], the second item has index [1] etc.
3
List Items
List items are ordered, changeable, and allow duplicate values.
1.Ordered
When we say that lists are ordered, it means that the items have a defined order, and that order will not change.
If you add new items to a list, the new items will be placed at the end of the list.
4
2.Changeable
The list is changeable, meaning that we can change, add, and remove items in a list after it has been created.
5
3.Allow Duplicates
Since lists are indexed, lists can have items with the same value:
Example
Lists allow duplicate values:
thislist = ["apple", "banana", "cherry", "apple", "cherry"]
print(thislist)
6
List Length
To determine how many items a list has, use the len() function:
Example
Print the number of items in the list:
thislist = ["apple", "banana", "cherry"]
print(len(thislist))
7
List Items - Data Types
List items can be of any data type:
Example
String, int and boolean data types:
list1 = ["apple", "banana", "cherry"]
list2 = [1, 5, 7, 9, 3]
list3 = [True, False, False]
print(list1)
print(list2)
print(list3)
8
A list can contain different data types:
Example
A list with strings, integers and boolean values:
list1 = ["abc", 34, True, 40, "male"]
print(list1)
9
type()
From Python's perspective, lists are defined as objects with the data type 'list':
<class 'list'>
Example
What is the data type of a list?
mylist = ["apple", "banana", "cherry"]
print(type(mylist))
10
The list() Constructor
It is also possible to use the list() constructor when creating a new list.
Example
Using the list() constructor to make a List:
thislist = list(("apple", "banana", "cherry")) # note the double round-brackets
print(thislist)
11
Multiple Choice
Lists are used to store single item in a single variable.
True
False
12
Multiple Choice
List items are ordered, changeable, and allow duplicate values.
True
False
13
Multiple Choice
List items are indexed, the first item has index [1], the second item has index [2] etc.
True
False
14
Multiple Choice
When we say that lists are ordered, it means that the items have a defined order, and that order will not change.
True
False
15
Multiple Choice
List items can be of any data type:
True
False
16
Multiple Choice
If you add new items to a list, the new items will be placed at the end of the list.
True
False
17
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]
18
Multiple Choice
List items have an index number. In the following list, which item has the index number of 3?
["John", "Harry", "Jesse", "John", "Harry", "Harry"]
"John"
"Harry"
"Jesse"
19
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"]
20
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")
21
Multiple Choice
What will be the result of the following syntax:
mylist = ['apple', 'banana', 'cherry']
print(mylist[1])
22
Multiple Choice
23
Multiple Choice
What will be the result of the following syntax:
mylist = ['apple', 'banana', 'banana', 'cherry']
print(mylist[2])
24
Multiple Choice
Is this the correct code for a list?
register = {"Sam", "Pheobe", Georgia", Richard"}
Yes
No
25
Multiple Choice
True or False.
List items cannot be removed after the list has been created.
26
Multiple Choice
The count() method returns the number of times the specified element appears in the list.
What is the output of this code?
3
2
1
0
27
Multiple Choice
Output of this code?
[2,4,6,8,10]
['2','4','6','8','10']
[0,2,4,6,8]
[10,8,6,4,2]
28
Multiple Choice
What is the index of “grape” in the list
[“apple”, “grape”, “orange”, “watermelon”]?
0
1
2
3
LESSON 2: PYTHON LIST
How do we use list in python??
Show answer
Auto Play
Slide 1 / 28
SLIDE
Similar Resources on Wayground
20 questions
PowerPoint Exercise
Presentation
•
8th - 9th Grade
23 questions
Tumpukan (Stack) dan Antrean (Queue)
Presentation
•
10th Grade
18 questions
For loops in python
Presentation
•
9th Grade
21 questions
Chapter 1 Nature of Technology Year 4
Presentation
•
10th Grade
21 questions
Exploring UI Elements
Presentation
•
8th Grade
21 questions
Exponent Rules Application
Presentation
•
9th Grade
22 questions
Applications of Radicals Part 2
Presentation
•
9th Grade
19 questions
QUARTER 4 WEEK 1 - INSTALLING AND CONFIGURING COMPUTER SYSTEMS
Presentation
•
9th Grade
Popular Resources on Wayground
6 questions
Secondary Safety Quiz
Presentation
•
9th - 12th Grade
10 questions
Afterschool Activities & Sports
Quiz
•
6th - 8th Grade
19 questions
ROAR Week 2026
Quiz
•
9th - 12th Grade
20 questions
Lab Safety Quiz
Quiz
•
6th Grade
15 questions
Cool Tool:Chromebook
Quiz
•
6th - 8th Grade
22 questions
would you rather
Quiz
•
3rd - 11th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
Discover more resources for Computers
20 questions
Early Computing
Quiz
•
7th - 12th Grade
10 questions
Exploring the Parts of a Computer
Interactive video
•
6th - 10th Grade
10 questions
Navigating Digital Citizenship and Online Safety
Interactive video
•
6th - 10th Grade
10 questions
Mastering Proper Keyboarding Techniques
Interactive video
•
6th - 10th Grade