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

Currently there are no comments in this discussion, be the first to comment!


Save Cancel