Open main menu

CDOT Wiki β

Changes

Rchan sandbox

371 bytes added, 00:34, 3 November 2019
Part 3 - Another approach to perform operation on time objects
:4. You should get the same result as shown above. If not, please troubleshoot and fix any errors.
:5. Edit your lab7c.py again. Modify the other two functions: sum_times() and change_time() to use the two new functions to perform the computation operation.
:6. Create a new Python script named '''lab7c1.py''' with and place the following contentin it:<source lang="python">#!/usr/bin/env python3# Student ID: [seneca_id]from lab7c import *t1 = Time(8,0,0)t2 = Time(8,55,0)t3 = Time(9,50,0)
td = Time(0,50,0)
 
tsum1 = sum_times(t1,td)
tsum2 = sum_times(t2,td)
tsum3 = sum_times(t3,td)
 
ft = format_time
print(ft(t1),'+',ft(td),'-->',ft(tsum1))
print(ft(t2),'+',ft(td),'-->',ft(tsum2))
print(ft(t3),'+',ft(td),'-->',ft(tsum3))
</source>
1,760
edits