0
0
Pythonprogramming~5 mins

List creation and representation in Python - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a list in Python?
A list in Python is a collection of items that are ordered and changeable. You can store multiple values in one variable.
Click to reveal answer
beginner
How do you create an empty list in Python?
You create an empty list by using square brackets with nothing inside: [].
Click to reveal answer
beginner
What will be the output of print([1, 2, 3])?
The output will be [1, 2, 3]. It shows the list with its elements inside square brackets separated by commas.
Click to reveal answer
intermediate
How can you create a list with different types of items?
You can put different types of items inside a list, like numbers, strings, or even other lists: [1, 'apple', 3.14, [2, 3]].
Click to reveal answer
beginner
What does the list ['a', 'b', 'c'] represent?
It represents a list of three string items: 'a', 'b', and 'c'. Lists keep the order of items as they are written.
Click to reveal answer
Which symbol is used to create a list in Python?
AParentheses ()
BCurly braces {}
CAngle brackets <>
DSquare brackets []
What will print([]) output?
ANone
BAn error
CAn empty list: []
DEmpty string
Can a Python list contain items of different types?
AOnly strings are allowed
BYes, lists can hold mixed types
COnly numbers are allowed
DNo, all items must be the same type
What is the output of print([1, 2, 3][0])?
A1
B2
C3
D[1, 2, 3]
How do you represent a list with three string items 'a', 'b', and 'c'?
A['a', 'b', 'c']
B{'a', 'b', 'c'}
C(a, b, c)
D<a, b, c>
Explain how to create a list in Python and how it is shown when printed.
Think about the symbols and how items are arranged inside.
You got /4 concepts.
    Describe what an empty list is and how you can create one.
    It's like an empty box waiting to be filled.
    You got /3 concepts.