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 Exam JN0-223 Topic 2 Question 7 Discussion

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

Given the following Python script:

a = [1,2,3,4,5,6,7,8,9]

print(a[0])

What is the output of this print command?

Show Suggested Answer Hide Answer
Suggested Answer: A

In Python, lists are zero-indexed, meaning the first element of the list is at index 0. The given script is:

pythona = [1, 2, 3, 4, 5, 6, 7, 8, 9]

print(a[0])

a[0] refers to the first element in the list a, which is 1.

So, the output of the print(a[0]) command is 1.

Option A is correct because Python indexing starts at 0, making the first element of the list at index 0.


Python Official Documentation: Covers list indexing and operations.

Python Programming Tutorials: Provide examples of list indexing.

Contribute your Thoughts:

Sue
3 months ago
I'm not sure, but I think it's A) 1 as well.
upvoted 0 times
...
Vanna
3 months ago
I agree with Fletcher, the output should be A) 1.
upvoted 0 times
...
Jeannine
3 months ago
This is just too easy. The answer is clearly A, 1. I'm a Python pro, baby!
upvoted 0 times
...
Quentin
4 months ago
Hmm, this is a tough one. I'm going to have to go with B, 2. Arrays, man, they never cease to amaze me.
upvoted 0 times
Matthew
2 months ago
User3: C) 7
upvoted 0 times
...
Maryrose
2 months ago
User2: B) 2
upvoted 0 times
...
Elfrieda
2 months ago
User1: A) 1
upvoted 0 times
...
...
Wei
4 months ago
I'm feeling lucky, let's go with D, 9! Who doesn't love a good surprise when it comes to coding?
upvoted 0 times
...
Craig
4 months ago
Wait, is this a trick question? I'm going with C, 7. The array looks like it's index-based, right?
upvoted 0 times
Marilynn
3 months ago
User4: D) 9
upvoted 0 times
...
Lorrine
3 months ago
C) 7
upvoted 0 times
...
Serita
3 months ago
B) 2
upvoted 0 times
...
Louvenia
3 months ago
A) 1
upvoted 0 times
...
...
Mozell
4 months ago
Ha! Tricky question. The answer is A, 1. Gotta love those Python lists.
upvoted 0 times
Cyril
3 months ago
That's right, it's A) 1
upvoted 0 times
...
Shenika
3 months ago
Yeah, it's definitely A) 1
upvoted 0 times
...
Rodrigo
4 months ago
I think the output is A) 1
upvoted 0 times
...
...
Fletcher
4 months ago
I think the output is A) 1 because the index starts at 0.
upvoted 0 times
...
James
4 months ago
Easy peasy, the output is 1. Arrays in Python start at index 0, so a[0] is the first element.
upvoted 0 times
Rose
3 months ago
Nice job!
upvoted 0 times
...
Julian
3 months ago
Easy peasy!
upvoted 0 times
...
Evangelina
3 months ago
Correct! Arrays in Python start at index 0.
upvoted 0 times
...
Odette
3 months ago
A) 1
upvoted 0 times
...
...
Verda
4 months ago
A) 1
upvoted 0 times
...

Save Cancel