Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Juniper JN0-224 Exam - Topic 2 Question 16 Discussion

You want to make a list in Python to store data.Which statement is the correct way to accomplish this task?
C) L = [0, 1, 2, 3, 4, 5]
A) L = '0, 1, 2, 3, 4, 5'
B) L = {0, 1, 2, 3, 4, 5}
D) L = (0, 1, 2, 3, 4, 5)

Juniper JN0-224 Exam - Topic 2 Question 16 Discussion

Actual exam question for Juniper's JN0-224 exam
Question #: 16
Topic #: 2
[All JN0-224 Questions]

You want to make a list in Python to store data.

Which statement is the correct way to accomplish this task?

Show Suggested Answer Hide Answer
Suggested Answer: C

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.

Other options are incorrect:

A defines a string, not a list.

B defines a set, which is an unordered collection with no duplicate elements.

D defines a tuple, which is an immutable sequence, not a list.


Python Official Documentation: Discusses lists, sets, tuples, and their syntaxes.

Python Data Structures Guide: Provides examples of creating and manipulating lists.

Contribute your Thoughts:

0/2000 characters
Erick
3 days ago
B looks like a set, not a list!
upvoted 0 times
...
Tabetha
8 days ago
I thought D could work too, but it's a tuple, not a list.
upvoted 0 times
...
Luke
14 days ago
Wait, isn't A just a string?
upvoted 0 times
...
Herminia
19 days ago
Agreed, C is the right choice!
upvoted 0 times
...
Gracia
24 days ago
It's definitely C! That's how you create a list.
upvoted 0 times
...
Elizabeth
29 days ago
I'm a bit confused. I know sets use curly braces, so option B can't be right, but I can't remember if lists are square brackets or not.
upvoted 0 times
...
Francene
1 month ago
I feel like I practiced a question like this before, and I chose option C for lists. That seems right to me!
upvoted 0 times
...
Luis
1 month ago
I remember something about lists and tuples. I think tuples use parentheses, so maybe option D is wrong?
upvoted 0 times
...
Dorothea
1 month ago
I think the list should be defined with square brackets, but I'm not completely sure. Was it option C?
upvoted 0 times
...

Save Cancel