1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
def engagement_rate(likes, comments, shares, followers):
total = likes + comments + shares
return round((total / followers) * 100, 2) if followers > 0 else 0
def calculate_reach(impressions, followers):
return round((impressions / followers) * 100, 1) if followers > 0 else 0
posts = [
{"likes": 150, "comments": 30, "shares": 10, "impressions": 5000, "followers": 2000},
{"likes": 80, "comments": 15, "shares": 5, "impressions": 3000, "followers": 2000},
]
for i, post in enumerate(posts, 1):
er = engagement_rate(post["likes"], post["comments"], post["shares"], post["followers"])
reach = calculate_reach(post["impressions"], post["followers"])
print(f"Post {i}: Engagement={er}% | Reach={reach}%")