Python Conversion Programs

Convert Minutes To Hours And Minutes In Python

Last updated January 31, 2024 by Jarvis Silva

Looking for a tutorial on python converting minutes to hours and minutes then you are at the right place, today in this python tutorial I will show you how to convert minutes to hours and minutes in python.

Before we see the code the let’s see how it will work

# Example 1
INPUT: 120 Minutes
OUTPUT: 2 hours

# Example 2
INPUT: 220 Minutes
OUTPUT: 3:40 hours

So overall the program will convert the given minutes in hours and minutes format like 110 minutes will be 1:50 hours, so now let’s convert this in python code.

Python Code To Convert Minutes To Hours And Minutes

total_minutes = 130

# Get hours with floor division
hours = total_minutes // 60

# Get additional minutes with modulus
minutes = total_minutes % 60

# Create time as a string
time = "{}:{}".format(hours, minutes)


Copy and paste the above code in a python file and run it in your python compiler or use an online compiler. After you run the above code, below is the output you should get, you can add any minutes in the minutes variable


As you can see it successfully converts, So this was for this article. I hope you successfully ran this program and found what you were looking for.

Here are more python guides you may find helpful:

I hope you found what you were looking for, share this guide with your programmers friend and also join our Telegram channel for more updates.

Thanks for reading, have a nice day 🙂