Open main menu

CDOT Wiki β

Changes

OPS445 Online Lab7

19 bytes added, 08:59, 13 March 2022
m
Part 2 - Special object methods
def __repr__(self):
'''return a string representation for the object self'''
return '%.2d.%.2d.%.2d' % (self.hour'just instead of ':', selfyou are required use the '.minute, self' in the formatting string.second) '''
</source>
:6. Add the function definition for __repr__() after the __str__() function in lab7e.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.
572
edits