Courseiva
hardMultiple ChoiceObjective-mapped

200-901 Practice Question: A developer is writing a Python script that uses…

A developer is writing a Python script that uses the Cisco Meraki API to retrieve a list of networks for an organization. The API returns a JSON array. The developer wants to filter networks where the 'tags' field contains 'production'. Which code snippet correctly filters the results?

⚠ Common exam trap

Cisco often tests the distinction between list membership (`in` on a list) and substring matching (`in` on a string), leading candidates to overcomplicate the filter with `split()` or `any()` when the API already returns a list.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

filtered = [net for net in networks if 'production' in net['tags']]

The Meraki API returns the 'tags' field as a list of strings (e.g., ['production', 'critical']). The Python `in` operator directly checks membership in a list, so `'production' in net['tags']` efficiently filters networks where the exact string 'production' appears as an element in the list.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • filtered = [net for net in networks if 'production' in net['tags']]

    Why this is correct

    Correct: 'tags' is a list, and 'in' works for list membership.

  • filtered = [net for net in networks if 'production' in str(net['tags'])]

    Why it's wrong here

    Incorrect: Converting to string may cause false positives.

  • filtered = [net for net in networks if 'production' in net['tags'].split(',')]

    Why it's wrong here

    Incorrect: 'tags' is already a list, not a comma-separated string.

  • filtered = [net for net in networks if any('production' in t for t in net['tags'])]

    Why it's wrong here

    Incorrect: This is unnecessarily complex; 'in' works directly on lists.

About these practice questions

Courseiva writes every 200-901 question from scratch — 989 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 200-901 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 200-901 exam.