Python Golf

Liste des GroupesRevenir à cl python 
Sujet : Python Golf
De : ram (at) *nospam* zedat.fu-berlin.de (Stefan Ram)
Groupes : comp.lang.python
Date : 07. Nov 2023, 09:37:29
Autres entêtes
Organisation : Stefan Ram
Message-ID : <shorter-20231107093650@ram.dialup.fu-berlin.de>
  I read this in a shell newsgroup:

perl -anE '$s += $F[1]; END {say $s}' in

  , so I wrote

py -c "import sys; print(sum(int(F.split()[1])for F in sys.stdin))" <in

  to show that this is possible with Python too.

  But now people complain that it's longer than the Perl version.

  Do you see ways to make it shorter (beyond removing one space
  after the semicolon ";")?



Date Sujet#  Auteur
7 Nov 23 o Python Golf1Stefan Ram

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal