There is something I don't understand about Python's problem in the exam called CCNP ENCOR, so I am writing to you. Here is the problem.

Asked 2 years ago, Updated 2 years ago, 22 views

Please refer to the exhibition.Which Python code snippet prints only descriptions of disabled interfaces?
Enter a description of the image here

Option A:

for interface in netconf_data ["GigabitEthernet"]:
    print(interface["enabled"])
    print(interface["description"])

Option B:

for interface in netconf_data ["GigabitEthernet"]:
    if interface ["disabled"]!='true':
    print(interface["description"])

Choice C:

for interface in netconf_data ["GigabitEthernet"]:
    if interface ["enabled"]!='true':
        print(interface["description")

Option D:

for interface in netconf_data ["GigabitEthernet"]:
    if interface ["enabled"]!='false':
        print(interface["description"])

I don't know which one is correct because the answer to this question varies from site to site.

Here is the reference site.

https://itexamanswers.net/ccie-ccnp-350-401-encor-dumps-full-questions-with-vce-pdf.html/2

This is the 379th question.

By the way, I chose the answer to D.

If you do not understand this problem, CCNP ENCOR will fail.

Please lend me your wisdom.
Thank you for your cooperation.

python

2022-09-30 19:54

1 Answers

The correct answer should be C.For the if conditional clause to pick up only disabled items, see

 interface ["enabled"]!='true'

In short, interface["enabled"]=='false', which means disabled

On the other hand, D is

 interface ["enabled"]!='false'

In short, interface["enabled"]=='true', that is, enabled

For your information, A does not use if in the first place (❌) and B uses if block incorrectly (no indentation) (❌).


2022-09-30 19:54

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.