73.7k views
3 votes
Write a Python script to input time in minutes , convert and print into hours and minutes.

1 Answer

3 votes

Answer:

Following are the Python program to this question: t=float(input("Enter time value in seconds: "))#input time in seconds by user

d = t // (24 * 3600) #calculate day and store in d variable t= t % (24 * 3600)#calculate time and store in t variable h = t // 3600#calculate hour and store in h variable t %= 3600#calculate time and store in t variable m=t // 60#calculate minutes and store in m variable t%= 60#calculate time and store in t variable s = t#calculate second and store in s variable print("day:hour:minute:second= %d:%d:%d:%d" % (d,h,m,s))#print calculated value

Output:

Enter time value in seconds: 1239876

day:hour:minute:second= 14:8:24:36

Step-by-step explanation:

Description of the above can be defined as follows:

  • In the above Python program code an input variable "t" is declared, which uses the input method to input value from the user end.
  • In the next step, "d, m, and s" is declared that calculates and stores values in its variable and at the last print, the method is used to print its value.
User Raymond Valdes
by
5.5k points