Oct-29-2021, 05:19 PM
(Oct-29-2021, 04:12 PM)deanhystad Wrote: Generate random lists of numbers and use the posted code(s) to compute the answer. You don't need an answer sheet when you have code that generates the correct answer.
Personally I think a lot of insight is gained by solving this problem by hand. I blanked on this problem until I wrote a list of numbers and a list of sums. I looked at that for about 10 seconds and the solution was immediately obvious.
Well , I did that of course, but maybe I'm missing something.
What should x = [-1,-2,-3,-4] yield ?
As I understand it : -1
Or are single values not allowed , although it is a "subarray".
Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.