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


Groups > comp.lang.python > #49374

? get negative from prod(x) when x is positive integers

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <vincent@vincentdavis.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.108
X-Spam-Level *
X-Spam-Evidence '*H*': 0.79; '*S*': 0.00; 'calculating': 0.09; 'integers': 0.09; 'received:209.85.219': 0.09; '......': 0.16; 'integers.': 0.16; 'skip:[ 30': 0.16; 'subject:when': 0.16; 'example': 0.22; 'to:name:python-list@python.org': 0.22; 'example.': 0.24; 'subject:) ': 0.29; 'message- id:@mail.gmail.com': 0.30; 'lists': 0.32; 'actual': 0.34; 'subject:from': 0.34; 'received:209.85': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'doing': 0.36; 'skip:- 20': 0.37; 'list': 0.37; 'received:209': 0.37; 'lists.': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'negative': 0.60; 'subject:? ': 0.60; 'show': 0.63; 'skip:1 20': 0.65; '.....': 0.78; 'subject:get': 0.81; 'max,': 0.84; 'on?': 0.91
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type :x-gm-message-state; bh=uomGKAMy8q28UYs8MK8twIMZcu8UGPnsqjxf2IJLldQ=; b=HwCWMn3Tml7CHciww4TRUPSvcAT0PoxH3LmFpAEJuvA9XDTdwx2Y7X+tzo9CIDqCfv N23zOcIUxZ+Xt9IhelwihfA5KJL8ovWcoIDGzrXCbbrJYAFVgQR4zbUVsum0P1wj8Wdz kxCRvp+TNNrfSkslxrjSmfwlNhTbZwJnA9t1ocZzf8IJXKCboSVdeSL8k7st8wciXxXE J2n18beNXcMsO4ZZRTBBaBlWQDiKzsIYAsGLO0BT3WjhdQurfA0hUXejTlVB9zoteIfy 5s4w0p0gJd/YGTdUPy7vvpew/OWcthK9gZ1wcAc0+9iG6toEsrEj7u1fTvD+Ndty8fxz VpXQ==
MIME-Version 1.0
X-Received by 10.182.196.1 with SMTP id ii1mr6477361obc.93.1372430314932; Fri, 28 Jun 2013 07:38:34 -0700 (PDT)
Date Fri, 28 Jun 2013 15:38:34 +0100
Subject ? get negative from prod(x) when x is positive integers
From Vincent Davis <vincent@vincentdavis.net>
To "python-list@python.org" <python-list@python.org>
Content-Type multipart/alternative; boundary=089e015383e0669d4c04e037d59c
X-Gm-Message-State ALoCoQlN/IUQfEt2KLrGx0mTaTBJFOCa1c367zKOqIvAElQJxPktvfrY6ZTAkZru5Mzbs+nzWkz5
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3958.1372430325.3114.python-list@python.org> (permalink)
Lines 111
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1372430325 news.xs4all.nl 15990 [2001:888:2000:d::a6]:48492
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:49374

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

I have a list of a list of integers. The lists are long so i cant really
show an actual example of on of the lists, but I know that they contain
only the integers 1,2,3,4. so for example.
s2 = [[1,2,2,3,2,1,4,4],[2,4,3,2,3,1]]

I am calculating the product, sum, max, min.... of each list in s2 but I
get negative or 0 for the product for a lot of the lists. (I am doing this
in ipython)

for x in s2:
    print('len = ', len(x), 'sum = ', sum(x), 'prod = ', prod(x), 'max = ',
max(x), 'min = ', min(x))

...

('len = ', 100, 'sum = ', 247, 'prod = ', 0, 'max = ', 4, 'min = ', 1)
('len = ', 100, 'sum = ', 230, 'prod = ', -4611686018427387904, 'max =
', 4, 'min = ', 1)
('len = ', 100, 'sum = ', 261, 'prod = ', 0, 'max = ', 4, 'min = ', 1)

.....

('prod =', 0, 'max =', 4, 'min =', 1)
('prod =', 1729382256910270464, 'max =', 4, 'min =', 1)
('prod =', 0, 'max =', 4, 'min =', 1)

....


Whats going on?



Vincent Davis
720-301-3003

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


Thread

? get negative from prod(x) when x is positive integers Vincent Davis <vincent@vincentdavis.net> - 2013-06-28 15:38 +0100

csiph-web