Re: What I learned today

2020-02-17 Thread 황병희
r...@zedat.fu-berlin.de (Stefan Ram) writes: > ... > But the book told me that you can unzip using ... »zip« again! > > z = zip( x, y ) > a, b = zip( *z ) > print( a ) > ('y', 'n', 'a', 'n', 't') > print( b ) >

Re: What I learned today

2020-02-15 Thread Peter Otten
Stefan Ram wrote: > The other thing I read in a book. I already knew that one > can zip using ... »zip«. E.g., > > x =( 'y', 'n', 'a', 'n', 't' ) > y =( 4, 2, 7, 3,1 ) > z = zip( x, y ) > print( list( z )) > [('y', 4), ('n', 2), ('a', 7), ('n', 3), ('t', 1)] > > But the book told me t

Re: What I learned today

2020-02-14 Thread duncan smith
On 14/02/2020 23:21, Dan Stromberg wrote: > On Fri, Feb 14, 2020 at 3:10 PM Stefan Ram wrote: > >> By trial and error (never read documentation!) I found >> that you can count the number of e's in a text by just >> >> Counter( text ).get( 'e' ) >> >> (after »from collections import Counter«

Re: What I learned today

2020-02-14 Thread Dan Stromberg
On Fri, Feb 14, 2020 at 3:10 PM Stefan Ram wrote: > By trial and error (never read documentation!) I found > that you can count the number of e's in a text by just > > Counter( text ).get( 'e' ) > > (after »from collections import Counter« that is). > Even simpler, though not suitable for a