Assuming the class looks something like this:
main.py156 chars6 lines
To add the values of one Time
object to another, you could define a method like this:
main.py501 chars18 lines
Here, the add_time
method takes another Time
object as an argument and adds its hours
, minutes
, and seconds
values to those of the current object, while also making sure to carry over excess seconds and minutes as needed.
To use this method to add two Time
objects together, you could do something like this:
main.py117 chars5 lines
gistlibby LogSnag