Python Forum
Reading Multiple Lists Using SUM function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reading Multiple Lists Using SUM function
#5
It's a text file with 259 identical lists like so.

p8262 = [331, 83, 112, 111, 21, 67, 8]
p8264 = [384, 84, 119, 74, 28, 51, 6]
p8401 = [330, 114, 217, 81, 11, 52, 5]

...

print(f"The sum of p8262 is {sum(p8262)}")

Can just the name of the lists be assigned as a variable then I could print out the list name and sum return.

Best
Reply


Messages In This Thread
RE: Reading Multiple Lists Using SUM function - by dgrunwal - Jun-03-2020, 07:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python convert multiple files to multiple lists MCL169 6 1,568 Nov-25-2023, 05:31 AM
Last Post: Iqratech
  function return boolean based on GPIO pin reading caslor 2 1,193 Feb-04-2023, 12:30 PM
Last Post: caslor
  Use ranking function for different lists klatlap 6 2,017 Feb-15-2022, 11:31 PM
Last Post: klatlap
Sad Iterate randint() multiple times when calling a function Jake123 2 2,061 Feb-15-2022, 10:56 PM
Last Post: deanhystad
  Help with WebSocket reading data from anoter function korenron 0 1,344 Sep-19-2021, 11:08 AM
Last Post: korenron
  Pop function for lists jamesaarr 8 2,661 Aug-26-2021, 06:40 PM
Last Post: ndc85430
  Generate a string of words for multiple lists of words in txt files in order. AnicraftPlayz 2 2,826 Aug-11-2021, 03:45 PM
Last Post: jamesaarr
  Create Dict from multiple Lists with duplicate Keys rhat398 10 4,089 Jun-26-2021, 11:12 AM
Last Post: Larz60+
  Reading Multiple text Files in pyhton Fatim 1 1,942 Jun-25-2021, 01:37 PM
Last Post: deanhystad
  Function - Return multiple values tester_V 10 4,470 Jun-02-2021, 05:34 AM
Last Post: tester_V

Forum Jump:

User Panel Messages

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