mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-12 10:00:39 -04:00
1.0 KiB
1.0 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 6578b57361f2f132a02e2a18 | Paso 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--