Write a python program to calculate number of seconds in a year.

Free photo: Accounts - Account, Accountant, Calculate - Free Download -  Jooinn

There are 60 seconds in one minute in a day. We can easily calculate number of seconds in one year. We can also find number of seconds in leap year as well as in non leap year. In this program ,we will also calculate number of seconds in one week and one month. Lets see how

Program-1:

Write a python program that calculates and prints the number of seconds in a year.

# python program that calculates and prints the number of seconds in a year.
Min = 60
Hour = Min * 60
Day = 24 * Hour
non_leap_year = 365 * Day
Leap_year = 366 * Day
print ( "number of seconds in one Hour ",Hour )
print ( "number of seconds in one day ",Day )
print ( "number of seconds in non Leap year ",non_leap_year )
print ( "number of seconds in Leap year ",Leap_year )


Output 

>>> %Run 'second in year.py'

number of seconds in one Hour  3600
number of seconds in one day  86400
number of seconds in non Leap year  31536000
number of seconds in Leap year  31622400

Python program to calculate number of seconds in a week,month and year

# python program that calculates and prints the number of seconds in a week,month and year.
Min = 60
Hour = Min * 60
Day = 24 * Hour
week = 7 * Day
month = 30* Day
print ( "number of seconds in one Hour = ",Hour )
print ( "number of seconds in one day = ",Day )
print ( "number of seconds in one week =",week )
print ( "number of seconds in one month =",month)
print ( "number of seconds in Feb month =",28 *Day)
print ( "number of seconds in months having 31 days =",31 *Day)




Output

>>> %Run 'second in week,month and year.py'
number of seconds in one Hour =  3600
number of seconds in one day =  86400
number of seconds in one week = 604800
number of seconds in one month = 2592000
number of seconds in Feb month = 2419200
number of seconds in months having 31 days = 2678400

Related programs :
<

Leave a Reply

Your email address will not be published.