Menu Close

Compute time from number of days/hours to seconds

Create a program that reads a duration from the user as a number of days, hours, minutes, and seconds. Compute and display the total number of seconds represented by this duration.

a=int(input("Days: "))
b=int(input("Hours: "))
c=int(input("Minutes: "))
d=int(input("Seconds: "))
e=d+c*60+b*3600+a*24*3600

print("\nDays= " + str(a))
print("Hours= " + str(b))
print("Minutes= " + str(c))
print("Seconds= " + str(d))
print("Total= " + str(e))


INPUT_1:
Days:  1
Hours:  0
Minutes:  0
Seconds:  0

OUTPUT:
Days=  1
Hours=  0
Minutes=  0
Seconds=  0
Total=  86400


INPUT_2:
Days:  2
Hours:  12
Minutes:  35
Seconds:  25

OUTPUT:
Days=  2
Hours=  12
Minutes=  35
Seconds=  25


ILLUSTRATION

Executed using python3

Morae Q!

  1. Program to get dictionary items, use update module and items module.
  2. Regular expression allowing certain set of characters.
  3. Compute the Sum of Cosine Series.
  4. Find the Sum of Sine Series.
  5. Remove the Vowels from the string.
  6. Find All Non-Overlapping strings/characters using regular expressions .
  7. Check whether the given string is Panagram or not.
  8. Replacing strings using Regular Expression Regex.
  9. Check whether the given number is Strong number or not.
  10. Find the numbers divisible by a input numbers within the given range.
  11. Change the behaviour of the Regular Expression using flags.
  12. Find the exponentiation of a number.
  13. Find all prime numbers in a range using Sieve of Eratosthenes.
  14. Convert decimal equivalent into binary, hexadecimal and octal.
  15. Compute the area of a farmers field in feet.
  16. Compute time from number of days/hours to seconds.
  17. Precompiled patterns using Regular Expressions .
  18. Compute the price of the cake on the nth day.
  19. Compute the number of possible non-increasing arrays.
  20. Find the type of spinach using the calorie value.