Adding up likes with a string mixed in

Predict the output · Basic · §13.1 Reading the red text to the end

This code adds up the number of likes post by post. Predict the output without running the code.

Code

def add_likes(total, post):
    return total + post["likes"]

posts = [{"likes": 12}, {"likes": "7"}, {"likes": 30}]
total = 0
for post in posts:
    total = add_likes(total, post)
    print("Running total:", total)
print("Total:", total)

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.