Search
We use the code implemented last week, from Wentworth2012 and make it more flexible by encapsulating the core functionality in functions.
2.14.5 Create a function compute_final_amount that will have P,r,n,t as the input parameters. Comment the function appropriately. Make the code robust against dividing by zero runtime problem:
compute_final_amount
P,r,n,t
time difference variant of 2.14.7 and 2.14.8. Implement a function compute_time_diff(h1,m1,h2,m2) that returns two values - hours, minutes - time difference between t2-t1, where the time is expressed in hours and minutes. Expect 24 hours notation. Required file name: 03_weekly_hw.py.
compute_time_diff(h1,m1,h2,m2)
03_weekly_hw.py
Usage:
>>> h,m = compute_time_diff(13,20,15,10) >>> print(h,m) 1 50