Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83214

Re: Help with map python 2

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: Help with map python 2
Date 2015-01-04 12:32 -0500
Organization IISS Elusive Unicorn
References <60e62263-6cd1-48b9-acbc-f1a0b947b8c9@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.17377.1420392749.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Sun, 4 Jan 2015 03:34:21 -0800 (PST), flebber <flebber.crue@gmail.com>
declaimed the following:

>In repsonse to this question: Write a program that prints the first 100 members of the sequence 2, -3, 4, -5, 6, -7, 8.
>
>This is my solution it works but ugly.
>
	<snip>

Let's see... a sequence of positive even integer values, interspersed with
the negative of the intervening odd integers...

>>> for i in range(50):
... 	j = 2 * (i + 1)
... 	print j, -(j + 1),
... 	
2 -3 4 -5 6 -7 8 -9 10 -11 12 -13 14 -15 16 -17 18 -19 20 -21 22 -23 24 -25
26 -27 28 -29 30 -31 32 -33 34 -35 36 -37 38 -39 40 -41 42 -43 44 -45 46
-47 48 -49 50 -51 52 -53 54 -55 56 -57 58 -59 60 -61 62 -63 64 -65 66 -67
68 -69 70 -71 72 -73 74 -75 76 -77 78 -79 80 -81 82 -83 84 -85 86 -87 88
-89 90 -91 92 -93 94 -95 96 -97 98 -99 100 -101
>>> 
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Help with map python 2 flebber <flebber.crue@gmail.com> - 2015-01-04 03:34 -0800
  Re: Help with map python 2 Chris Angelico <rosuav@gmail.com> - 2015-01-04 22:47 +1100
  Re: Help with map python 2 Alec Taylor <alec.taylor6@gmail.com> - 2015-01-04 22:47 +1100
  Re: Help with map python 2 Alec Taylor <alec.taylor6@gmail.com> - 2015-01-04 22:48 +1100
  Re: Help with map python 2 Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-01-04 14:08 +0200
    Re: Help with map python 2 flebber <flebber.crue@gmail.com> - 2015-01-05 03:33 -0800
      Re: Help with map python 2 Terry Reedy <tjreedy@udel.edu> - 2015-01-05 18:28 -0500
        Re: Help with map python 2 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-06 12:30 +1100
  Re: Help with map python 2 Peter Otten <__peter__@web.de> - 2015-01-04 17:33 +0100
  Re: Help with map python 2 Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-01-04 12:32 -0500
  Re: Help with map python 2 Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-01-04 12:41 -0500
  Re: Help with map python 2 Dan Stromberg <drsalists@gmail.com> - 2015-01-04 10:06 -0800
  Re: Help with map python 2 Terry Reedy <tjreedy@udel.edu> - 2015-01-04 16:13 -0500
    Re: Help with map python 2 flebber <flebber.crue@gmail.com> - 2015-01-05 03:37 -0800
  Re: Help with map python 2 Sayth Renshaw <flebber.crue@gmail.com> - 2015-01-04 21:22 +0000

csiph-web