(Sep-30-2021, 07:07 PM)Yoriz Wrote: It's your homework if that's the best you can do, sure, that's the best you can do.
if you correct your logic you can get rid of
if self.big > self.small: self.small, self.big = self.big, self.smallbecause that is already done in the__init__
def seven_boom_range(self): empty = [] for i in range(1, self.big - self.small + 1): if "7" in str(i) or i % 7 == 0: empty.append("BOOM") else: empty.append(i) empty.insert(0, 0) return emptyActually, managed again to do it, now without abs.
is that what you meant? I really hope so.. took me a few try and experience
(Sep-30-2021, 07:14 PM)Yoriz Wrote: What is the reasoning behind going from range 1 to big - small + 1
Is it maybe just supposed to go from the small number to the big number?
check your teacher's requirements.
There aint any teacher requirements.
All I wrote in the post ( about the questions, 1 2 3 4 ) is the quote he gave us for the question.
I quoted exactly from my laungage ( hebrew ) and translated myself to english, the exact words with same meaning.
And about the first range, because if I put 0, ill get zero division which is false.
so I start from 1.
about the +1, because otherwise I will reach 0 to 9.
lets say I put big 30, small 20
I will get a list of 0 to 9, but not 10, thats why I add +1.