Re: format_binary

Liste des GroupesRevenir à cl python 
Sujet : Re: format_binary
De : jon+usenet (at) *nospam* unequivocal.eu (Jon Ribbens)
Groupes : comp.lang.python
Date : 24. Sep 2026, 07:57:40
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <slrn11b9if4.2kd.jon+usenet@raven.unequivocal.eu>
References : 1 2 3
User-Agent : slrn/1.0.3 (Linux)
On 2026-09-24, Lawrence D’Oliveiro <ldo@nz.invalid> wrote:
On 23 Sep 2026 23:09:14 GMT, Stefan Ram wrote:
>
Like,
>
   ''.join( f'{i:08b}' for i in flag )
>
?
>
    def format_binary(n : int) :
        assert n >= 0
        return \
            "".join \
              (
                chr(ord("0") + (n & 1 << i != 0))
                for i in range(math.floor(math.log(max(n, 1)) / math.log(2)), -1, -1)
              )
    #end format_binary

Well, that is the absolute worst of all possible ways to do it, yes.

Date Sujet#  Auteur
24 Sep00:09 * Re: ''.join([bin(i)[2:].zfill(8) for i in flag])3Stefan Ram
24 Sep03:01 `* Re: format_binary2Lawrence D’Oliveiro
24 Sep07:57  `- Re: format_binary1Jon Ribbens

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal