Sep-30-2021, 09:25 PM
I think your __repr__ is wrong. The first requirement says "print in this format: small - (something), big - (something )". __repr__ should not include the gcd() or the sevenBoom().
I don't think sevenBoom should require you to pass values for big and small. TwoNumbers already has big and small and sevenBoom(self) should calculate the difference using self.big - self.small.
Since you already know big will be >= small, you can remove that test from sevenBoom.
Since you know sevenBoom will always start with [0, you may as well initialize empty = [0] instead of empty = []. Then you don't have to insert zero after the list is built.
I also don't think gcd() should require you to pass values for big and small. You should be able to do this:
You will have to figure out a way to write gcd() so you can call it without passing small and big, but still call it recursively to get the solution. That is a little tricky, but a common pattern for recursion. It is very common that the first function call and the last function call in a recursion are different than the intermediate function calls.
I don't think sevenBoom should require you to pass values for big and small. TwoNumbers already has big and small and sevenBoom(self) should calculate the difference using self.big - self.small.
Since you already know big will be >= small, you can remove that test from sevenBoom.
Since you know sevenBoom will always start with [0, you may as well initialize empty = [0] instead of empty = []. Then you don't have to insert zero after the list is built.
I also don't think gcd() should require you to pass values for big and small. You should be able to do this:
numbers = TwoNumbers(10, 20) print(numbers) print(numbers.gcd()) print(numbers.sevenBoom())I know it is not a stated requirement, but it is bad design, and good design should always be an expected requirement.
You will have to figure out a way to write gcd() so you can call it without passing small and big, but still call it recursively to get the solution. That is a little tricky, but a common pattern for recursion. It is very common that the first function call and the last function call in a recursion are different than the intermediate function calls.