Programming puzzles: processing lists!
|
12-30-2017, 05:49 PM
(This post was last modified: 12-30-2017 05:55 PM by StephenG1CMZ.)
Post: #233
|
|||
|
|||
RE: Programming puzzles: processing lists!
(12-30-2017 02:39 PM)pier4r Wrote: Just discovered, thanks to the work of Terje here (I wonder why HP does not release a pdf with the prime help. It would make things way easier, especially for search and bookmarking) that #41 on the prime can be done with the function cumSum. One oddity I just noticed was that cumSum({}) returns 0... Many built-ins don't handle empty lists well. But what should the answer be? {} means you can distinguish input {} from input {0} if desired Whereas {0} treats {} as {0}, just like my ListSigmaSum procedure (whereas the builtin SigmaSum fails). I am thinking returning {0} would be better, assuming there is no good reason to return 0. Eddie W Shore has a workaround for some other oddities here: http://www.hpmuseum.org/forum/thread-381...ght=cumSum Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)