' / str(my_f' / we can override many other methods for our new fraction class some of the most important of these are the basic arithmetic operations we would like to be able to create two fraction objects and then add them together using the standard "+notation at this pointif we try to add two fractionswe get the followingf fraction( , fraction( , traceback (most recent call last)file ""line in typeerrorunsupported operand type(sfor +'fractionand 'fractionif you look closely at the erroryou see that the problem is that the "+operator does not understand the fraction operands we can fix this by providing the fraction class with method that overrides the addition method in pythonthis method is called __add__ and it requires two parameters the firstselfis always neededand the second represents the other operand in the expression for examplef __add__( would ask the fraction object to add the fraction object to itself this can be written in the standard notationf two fractions must have the same denominator to be added the easiest way to make sure they have the same denominator is to simply use the product of the two denominators as common denominator so that ad cb ad cb bd bd bd the implementation is shown in listing the addition function returns new fraction object with the numerator and denominator of the sum we can use this method by writing standard arithmetic expression involving fractionsassigning the result of the additionand then printing our result listing adding fractions def __add__(selfother_fraction)new_num self num*other_fraction den self den*other_fraction num new_den self den other_fraction den review of basic python