Explore

Python Programs

Convert Days To Hours In Python

Convert Days To Hours In Python

Looking for a way to convert days to hours in python programming then you are at the right place, today in this article I will show you how to convert day to hours in python.

I have previously created a guide on converting minutes to hours and minutes format, if you want you can read it.

Before I show you how to convert days into hours in python, let’s see some example on how this will work


# Example 1
INPUT: 10 Days
OUTPUT: 240 hours

# Example 2
INPUT: 2 Days
OUTPUT: 48 hours

As you can see from the above examples we give it an input of 10 days then it gives us an output in 240 hours which is 10 days now let’s see this in code.

Convert Days To Hours In Python Code


days = int(input("Enter amount of days: "))

hours = days * 24

print(f"{hours} hours")

Copy the above python code which converts days to hours and paste it in your python file and run it on your computer or use an online python compiler.

Output


Enter amount of day: 10
240 hours

If you don’t have python installed you can install it from the python website, if you want a guide you can refer to this: Install and setup python.

Summary

So this was the tutorial on python convert days to hours. I hope you ran the program successfully and you got what you were looking for.

Here are more python guide that might help you:

I hope you found what you were looking for and share this guide if anyone wants to convert days to hours in python and join our Telegram channel for future updates.

Thanks for reading, have a nice day 🙂