Open main menu

CDOT Wiki β

Changes

Rchan sandbox

7 bytes added, 23:13, 2 November 2019
Part 2 - Pure Function and Modifiers
</source>
:5. If you encounter any syntax error or exception, please fix the error before moving on to the next step.
:6. Now try to set seconds to a '''negative''' value, e.g. -1800, and then call the '''change_time()''' function.Will it change the """time1 """ object back to '09:50:00'? Let's try it out:<source lang="bash">
>>> format_time(time1)
'10:20:00'
'10:20:-1800'
</source>
:7. The result is not correct! So we have to modify and update the change_time() function so that it can handle positive and negative value correctly. After updating the change_time() function, test it again in a Python interactive shell by importing the new version of the function.<source lang='bash'>
[rchan@centos7 lab7]$ python3
Python 3.4.9 (default, Aug 14 2018, 21:28:57)
1,760
edits