====== Computer Lab 03, Functions ====== ===== puzzle ===== * a weekly puzzle to train the brain ===== practical work ===== We use the code implemented last week, from [[http://openbookproject.net/thinkcs/python/english3e/|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. Test the functionality. **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. Usage: >>> h,m = compute_time_diff(13,20,15,10) >>> print(h,m) 1 50 ===== homework ===== * Solve homework [[courses:be5b33prg:homeworks:right_triangle|]] and submit it via Upload system in time! Check the deadline in Upload system. * Read chapters 6,7,8,9 from [[http://openbookproject.net/thinkcs/python/english3e/|Wentworth2012]]. This material is for the next two lectures/labs.