Question: i am trying to create a rational class and keep getting this error. what does the typeError __str__returned non-string mean? screenshots of the program and

i am trying to create a rational class and keep getting this error. what does the typeError __str__returned non-string mean? screenshots of the program and the class portion where the apparent error is.
i am trying to create a rational class and keep getting this
error. what does the typeError __str__returned non-string mean? screenshots of the program

int TO sa string representation ( if self.__denominator -- 1: : return str(self. __numerator) else: return str(self. numerator) + "/",2 (self.. denominator) bulltins. TypeError: str returned non-string (type tuple) #Create and initialize two rational numbers ri 2 5and r2 6 7 ri Rational. Rational(4, 2) 8 r2 - Rational. Rational(2, 3) 9 10 11 #Display results 12 print(ri. r2) Search Stack Data Debug VO Python Shell Debug 1/0 (stdin, stdout. stderr) appears below Options 2 +

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!