
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)
Output
Enter number of seconds :86400 minutes : 1440 Remaining Seconds : 0 Enter number of seconds :345680 minutes : 5761 Remaining Seconds : 20
Latest post
- 20 Essential MySQL Queries for Managing Your Database
- Python Web Development: Frameworks and Applications
- A Beginner’s Guide to Machine Learning Algorithms and Their Applications in Python
- Python Game Development Libraries: A Beginner’s Guide to Pygame, PyOpenGL, and Panda3D
- How to convert Infix expression to Postfix expression using stack in python