How to Calculate the Value of Content Marketing | The Better Blog

Python program that ask the user to input number of seconds and converts it into minutes and remaining seconds

In this article,i will show you how to write python program to converts number of seconds into minutes. To find number of minutes in particular number of days,i will create the simple program that accept the number of seconds from user,then i will extract the number of minutes using integer division and finally i will use modulo operation to extract the number of remaining seconds. So here is how we can write a python program to convert seconds into minutes

# get the number of seconds from user
sec = input("Enter number of seconds :")
sec_int = int(sec)

# Extract the number of minutes
mins = sec_int // 60
# Extract the number of remaining seconds
rem_sec = sec_int % 60
print("minutes :",mins)
print("Remaining Seconds :",rem_sec)


Enter number of seconds :86400
minutes : 1440
Remaining Seconds : 0

Enter number of seconds :345680
minutes : 5761
Remaining Seconds : 20

Latest post


Leave a Reply

Your email address will not be published.