Nah he’ll get a TypeError. Not seeing why, honestly…
Unless you consider the merciless and systematic execution of all billionaires to be genocide…which I guess is technically fair…but it’s for a good cause! (…said every genocidist ever…)
Of course, I changed the name of the iterable…
And we’re talking about intro to compsci…getting a bit ahead of ourselves going right from loops to comprehension.
He just called everyone in the population a billionaire and executed them without actually checking if they are in fact billionaires.
Somewhat too close to reality in some scenarios for my taste…
basket = [ guillotine(billionaire) for billionaire in population ]Almost. You just committed genocide.
Nah he’ll get a TypeError.Not seeing why, honestly…Unless you consider the merciless and systematic execution of all billionaires to be genocide…which I guess is technically fair…but it’s for a good cause! (…said every genocidist ever…)
Of course, I changed the name of the iterable…
And we’re talking about intro to compsci…getting a bit ahead of ourselves going right from loops to comprehension.
basket = [ guillotine(human) for human in population if is_billionaire(human) ]There, now you’re not killing everyone on Earth
This is why we don’t test in prod.
He just called everyone in the population a billionaire and executed them without actually checking if they are in fact billionaires. Somewhat too close to reality in some scenarios for my taste…
Nope, billionaire is a designator, not a discriminator. They’re iterating over population and decapitating everyone regardless of wealth. ;)
It’s missing an
if <someOtherDesignatorForPopulatioMember> in billionairesin the comprehension.