Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python function help
#10
(Jun-14-2022, 10:36 AM)buran Wrote:
(Jun-14-2022, 07:13 AM)rob101 Wrote: I'll have to think about that one.
Hint: think slices

Ah... I think I see what you're driving at:
So, I'd leave 'result' as is, then slice 'listNums' from 1 to the end within the sum() function, which can then be decremented from 'result', right?

n.b: I'd post the one line of code that demonstrates the above, but I've already messed up and don't want to do that again.
Sig:
>>> import this

The UNIX philosophy: "Do one thing, and do it well."

"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse

"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
Reply


Messages In This Thread
python function help - by hardz1n51 - Jun-08-2022, 09:54 PM
RE: python function help - by ndc85430 - Jun-09-2022, 04:56 AM
RE: python function help - by deanhystad - Jun-09-2022, 03:05 PM
RE: python function help - by rob101 - Jun-13-2022, 10:02 PM
RE: python function help - by ndc85430 - Jun-09-2022, 08:16 PM
RE: python function help - by deanhystad - Jun-09-2022, 08:25 PM
RE: python function help - by deanhystad - Jun-14-2022, 01:46 AM
RE: python function help - by rob101 - Jun-14-2022, 07:13 AM
RE: python function help - by buran - Jun-14-2022, 10:36 AM
RE: python function help - by rob101 - Jun-14-2022, 05:43 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020