Looking up a missing key
Predict the output · Basic · §4.2 Updating dictionaries
This code tries to print the number of shares. Predict the result without running the code.
Code
post = {"likes": 120}
print(post["shares"])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.