exam questions

Exam 350-601 All Questions

View all questions & answers for the 350-601 exam

Exam 350-601 topic 1 question 302 discussion

Actual exam question from Cisco's 350-601
Question #: 302
Topic #: 1
[All 350-601 Questions]

An engineer implements a Python script inside a Cisco Bash shell. The script contains this dictionary object:

Which command must be used to add the 'N9K-Spine-2': '1498323434' element to the switch_id list dictionary?

  • A. switch_id_list += {ג€N9K-Spine-2ג€: ג€1498323434ג€}
  • B. switch_id_list = [ג€N9K-Spine-2ג€: ג€1498323434ג€]
  • C. switch_id_list.append({ג€N9K-Spine-2ג€: ג€1498323434ג€})
  • D. switch_id_list.update({ג€N9K-Spine-2ג€: ג€1498323434ג€})
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
roky
Highly Voted 2 years, 1 month ago
not append(), update() method is correct! switch_id_list = { "N9K-SPINE-1" : "0000", "N9K-LEAF-1" : "1111", "N9K-LEAF-2" : "2222" } switch_id_list.update({"N9K-Spine-2" : "3333"}) print(switch_id_list) =============================================== {'N9K-SPINE-1': '0000', 'N9K-LEAF-1': '1111', 'N9K-LEAF-2': '2222', 'N9K-Spine-2': '3333'} this switch_id_list type is "dict" not "list" ( plz using type() func! ) if it's type was "list" that append() method might be correct.
upvoted 6 times
...
PacketLife
Most Recent 1 year, 9 months ago
Selected Answer: D
https://techbeamers.com/python-dictionary/#append-in-a-dictionary
upvoted 3 times
redgremlin
1 year, 6 months ago
Option D is incorrect because the "update" method is used to update an existing key-value pair in a dictionary, not to add a new element to a list of dictionaries.
upvoted 1 times
CoAsT_x
5 months, 2 weeks ago
It IS option D. That is a dictionary. And has a key-value pair. denoted by curly braces and the "key":"value" pair.
upvoted 1 times
...
...
...
Hsma
2 years ago
Selected Answer: D
not append(), update() method is correct!
upvoted 4 times
...
GuyThatTakesDumps
2 years, 1 month ago
Selected Answer: D
D is the one!
upvoted 3 times
...
7korn7
2 years, 1 month ago
Selected Answer: D
Totally agree with rocky 'dict' object has no attribute 'append' in Python
upvoted 4 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago