Files
2024-05-22 17:27:37 +02:00

1.0 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
6578b57361f2f132a02e2a18 الخطوة 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 the assignment of your dictionary.

({ test: () => assert(runPython(`
    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--