> ## Content Index
> Fetch the complete content index at: https://www.boldoutlook.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Calculate the Engagement Rate of a Instagram Post using Python
- URL: https://www.boldoutlook.com/calculate-engagement-rate-instagram-post-python/
- Published: 2023-05-04T04:00:00.000Z
- Updated: 2025-07-26T02:43:06.000Z
- Description: The following is a simple Python script that can calculate the engagement rate of a Instagram post based upon the number of likes, comments and followers of the user who posted it.
- Author: Brandon Himpfen
- Tags: Digital, Python, Instagram, Social Media, Digital Marketing, Python Snippets, Code Snippets, #Import 2026-10-18 13:20

The following is a simple Python script that can calculate the engagement rate of a Instagram post based upon the number of likes, comments and followers of the user who posted it.

```python
# Import necessary modules
import math

# Define function to calculate engagement rate
def calc_engagement_rate(likes, comments, followers):
    engagement_rate = ((likes + comments) / followers) * 100
    return round(engagement_rate, 2)

# Define example values for likes, comments, and followers
likes = 1000
comments = 200
followers = 5000

# Calculate engagement rate using example values
engagement_rate = calc_engagement_rate(likes, comments, followers)

# Print result
print("Engagement rate: {}%".format(engagement_rate))

```

You will need to change the values of likes, comments and followers on lines ten to twelve.