Changes

Jump to: navigation, search

Rchan sandbox

No change in size, 20:13, 3 November 2019
Part 2 - Special object methods
return '%.2d.%2d.%2d' % (self.hour, self.minute, self.second)
</source>
:6. Add the function definition for __repr__() after the __str__() function in lab7dlab7e.py. Please note that we use the '.' instead of ':' in the formatting string. Make sure that the '''def __repr__(self):''' line has the same indentation level as the __init__() function.
:7. Save the file lab7e.py and test it in an interactive Python shell:<source lang="bash">
[rchan@centos7 lab7]$ python3
1,760
edits

Navigation menu