Juniper
JN0-224 · Question #151
You want to make a list in Python to store data. Which statement is the correct way to accomplish this task?
The correct answer is C. L = [0, 1, 2, 3, 4, 5]. In Python, to create a list, you use square brackets []. The correct syntax to create a list containing the numbers 0 through 5 is: L = [0, 1, 2, 3, 4, 5] This statement creates a list object that stores the specified integers.
Python
Question
You want to make a list in Python to store data. Which statement is the correct way to accomplish this task?
Options
- AL = "0, 1, 2, 3, 4, 5"
- BL = {0, 1, 2, 3, 4, 5}
- CL = [0, 1, 2, 3, 4, 5]
- DL = (0, 1, 2, 3, 4, 5)
How the community answered
(62 responses)- A2% (1)
- B3% (2)
- C89% (55)
- D6% (4)
Explanation
In Python, to create a list, you use square brackets []. The correct syntax to create a list containing the numbers 0 through 5 is: L = [0, 1, 2, 3, 4, 5] This statement creates a list object that stores the specified integers.
Topics
#Python lists#data structures#Python syntax#list creation
Community Discussion
No community discussion yet for this question.