1. Write a function which calculates the amount of hours, minutes, and seconds p
ID: 3566596 • Letter: 1
Question
1.
Write a function which calculates the amount of hours, minutes, and seconds passed the time of 00:00 in a 24
hour clock.
For example:
Enter how many seconds past 00:00: 342345
95 hours, 5 minutes and 45 seconds.
Since a day has 86,400 seconds (24*60*60), the range of input is 1 to 86,400. Your output should state the current
time as hours, minutes, and seconds with 24-hours clock.
2.
Write a function to calculate interest, based on principle, number of years, and interest rate.
Specifically, the calculation of the simple interest is on a principal amount of 10,000 for duration of 5 years with the
rate of interest equal to 12.5%.
As a clue, here is the formula for simple interest:
simple_interest = principle*time*rate_of_interest
Explanation / Answer
__author__ = 'praveenkotekal'
def calculate_hours_minutes_seconds(n):
'''
:param n:
:print hours minutes and seconds
'''
hours = n/(60*60)
minutes = (n%(60*60))/60
seconds = (n%(60*60)) - minutes*60
print 'hours : %s, minutes : %s, seconds : %s'%(hours,minutes,seconds)
def calculate_simple-interest():
P=float(raw_input("enter Principal:"))
i=float(raw_input("enter Percentage of interest rate:"))
t=float(raw_input("enter Time(in years):"))
I=P*t*(i/100)
print "Simple Interest is", I
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.