Why does `r1 + r2` come out holding the next ID in the sequence, and why does `__eq__` compare parent IDs rather than the parent objects themselves?
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
A rabbit prints its ID as five characters: an ID of 1 shows up as 00001, and an ID of 526 shows up as 00526. The ID given below is a plain integer.
Assign to padded_id that same ID as a five-character, zero-padded string. (Hint: zfill(n) is a string method that pads the front until the text is n characters long, and str() turns a number into text.)
The rabbit's getters and zfill(5)
List get_rid, get_parent1 and get_parent2, record that the id and the parents deliberately get no setters, and write str(self.rid).zfill(5), which turns 1 into 00001 and 123 into 00123.
__add__ returning a newborn rabbit
Write return Rabbit(0, self, oth) with self the thing before the plus and oth the thing after it, then trace r4 = r1 + r2 to a rabbit of age 0 with rid 4.
__eq__ comparing parent ids in either order
Write parents_same and parents_opp over the parents' rid values rather than the parent objects, note the earlier version crashed on a parent of None, and record r5 == r6 true with r4 == r6 false.