Question: If you need to create a class Fraction, what is the correct way to create data attributes for the class? Choose the most correct statements.
If you need to create a class Fraction, what is the correct way to create data attributes for the class? Choose the most correct statements. Assume that the class constructor starts with the following code and generates a reduced form of a fraction: def _init_(self, top, bottom): if type(top) common = gcd(top, bottom) \# cod ivisor of two numbers top = self.top self = top / bottom self.bottom = bottom // common bottom = bottom // common self bottom = bottom self.top = top self: top = top // common
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
