• JasonDJ@lemmy.zip
    link
    fedilink
    English
    arrow-up
    11
    ·
    edit-2
    7 天前
    basket = []
    for pos in billionaires: 
        if pos not in basket: 
    -       basket += guillotine(b)
    +      basket += guillotine(pos)  # Corrected iterable naming
    
      • abc@suppo.fi
        link
        fedilink
        English
        arrow-up
        3
        ·
        7 天前

        Haha, that’s either horrible if you don’t know what you just did there or brilliant parody if you did.

        • JasonDJ@lemmy.zip
          link
          fedilink
          English
          arrow-up
          2
          ·
          edit-2
          7 天前

          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.

          • pheelicks@lemmy.zip
            link
            fedilink
            English
            arrow-up
            8
            ·
            7 天前

            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…

          • Randelung@lemmy.world
            link
            fedilink
            English
            arrow-up
            7
            ·
            7 天前

            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 billionaires in the comprehension.