KeyError Handling

Issue

We've got some buggy code, try running the code. The code will crash and give you a KeyError. This is because some of the posts in the facebook_posts don't have any "Likes".

Bad Output

Instructions

Use what you've learnt about exception handling to prevent the program from crashing.

Hint

  1. You'll need to catch the KeyError exception.

  2. Posts without any likes can be counted as 0 likes.

Solution

https://repl.it/@appbrewery/day-30-2-solution