
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
24 questions
Dictionaries
Presentation
•
9th Grade
21 questions
Functions
Presentation
•
9th - 10th Grade
19 questions
Quadratic Transformations
Presentation
•
8th - 9th Grade
22 questions
Rock-paper-scissors (microbit)
Presentation
•
9th Grade
21 questions
Module 1 Lesson 2A: Computer Hardware Devices and Application Software - G9
Presentation
•
9th Grade
21 questions
Budgeting - An Introduction
Presentation
•
9th Grade
20 questions
Intensifiers
Presentation
•
9th Grade
20 questions
Arithmetic Sequences
Presentation
•
8th - 9th Grade
Popular Resources on Wayground
20 questions
STAAR Review Quiz #3
Quiz
•
8th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
6 questions
Marshmallow Farm Quiz
Quiz
•
2nd - 5th Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
20 questions
Inferences
Quiz
•
4th Grade
19 questions
Classifying Quadrilaterals
Quiz
•
3rd Grade
12 questions
What makes Nebraska's government unique?
Quiz
•
4th - 5th Grade
Discover more resources for Computers
7 questions
Warm Up 04.01.2026
Quiz
•
9th Grade
20 questions
Graphing Inequalities on a Number Line
Quiz
•
6th - 9th Grade
20 questions
Linear Functions Review
Quiz
•
9th Grade
30 questions
English 1 STAAR Review
Quiz
•
9th Grade
10 questions
Pythagorean Theorem and its Converse
Quiz
•
7th - 9th Grade
14 questions
Ecological Succession: Primary and Secondary
Quiz
•
9th Grade
2 questions
APRIL 2_4F Practice
Quiz
•
9th Grade
20 questions
Grammar
Quiz
•
9th - 12th Grade