A post bundled in a dictionary, with functions outside
Write code · Basic · §11.1 Data and behavior together
Each post is stored as one dictionary. Write a function like(post) that adds 1 to the post's likes, and a function add_comment(post, text) that adds the comment text to the end of comments.
Both functions change the dictionary they receive in place and return nothing. Grading also calls the functions with other post dictionaries.
Starter code
post = {"author": "mina", "likes": 0, "comments": []}
# Write like and add_comment here
like(post)
like(post)
add_comment(post, "Nice photo")
print(post)Solve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.