Files
2024-01-24 19:52:36 +01:00

1.1 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
6578b57361f2f132a02e2a18 Schritt 4 20 step-4

--description--

You can access the data stored in a dictionary through its keys:

my_dict = {
    'name': 'Michael',
    'occupation': 'Lumberjack`
}

my_dict['name'] # 'Michael'

After your dictionary, follow the example above to access the species key of copper and print the result.

--hints--

You should not modify your dictionary.

({ test: () => assert(__pyodide.runPython(`
    copper = __locals.get("copper")
    copper == {"species": "guinea pig", "age": 2}
  `))
})

You should use copper['species'] to access the value of the species key.

({ test: () => assert.match(code, /copper\s*\[\s*("|')species\1\s*\]/) })

You should call print() passing copper['species'] as argument.

({ test: () => assert.match(code, /^print\s*\(\s*copper\s*\[\s*("|')species\1\s*\]\s*\)/m) })

--seed--

--seed-contents--

--fcc-editable-region--
copper = {
    'species': 'guinea pig',
    'age': 2
}

--fcc-editable-region--