Try this exercise. Click the correct answer from the options.
Imagine you're building a document-oriented database in Python. Your add_document
function takes two parameters - db
representing the database and document
a JSON-like object you want to store. Supposedly, db
is a dictionary and you intend to add document
to it by associating it with a unique id. Select the correct syntax for adding document
to db
.
Click the option that best answers the question.
- `db[id] = document`
- `db.add(id, document)`
- `db.put(id, document)`
- `db.insert(id, document)`