Will the program work if you replace the __str__ method in lines 43–47 as follows?
def __str__(self):
if self.__denominator == 1:
return str(self[0])
else:
return str(self[0]) + "/" + str(self[1])
Sorry the answer is not available at the moment…
If you are able to find the answer, please make sure to post it here. So that your Juniors have smile on their lips and feel happy.
Spread the 'tradition of sharing'.