Python Forum
python convert multiple files to multiple lists
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python convert multiple files to multiple lists
#7
Sure, if you want to calculate the sum of values in col1 without using the sum() function, you can achieve this by using a loop to iterate through the values in lst and accumulate the sum. Here's an example:

python
Copy code
lst = [0.09, 0.44, 0.17, 0.82, 0.46, 0.35, 0.54]

# Calculate the sum without using sum()
total_sum = 0
for value in lst:
total_sum += value

print("Sum of col1:", total_sum)
This code initializes total_sum to 0 and then iterates through each value in lst, adding it to total_sum. Finally, it prints the calculated sum.

This approach provides an alternative way to calculate the sum without relying on the built-in sum() function.
buran write Nov-25-2023, 07:15 AM:
Please, use proper tags when post code, traceback, output, etc.
See BBcode help for more info.
Reply


Messages In This Thread
RE: python convert multiple files to multiple lists - by Iqratech - Nov-25-2023, 05:31 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to handle multiple audio uploads without canceling ongoing API requests? muba 2 873 Jan-01-2025, 01:04 AM
Last Post: Skaperen
  Convert Xls files into Csv in on premises sharpoint Andrew_andy9642 3 1,014 Aug-30-2024, 06:41 PM
Last Post: deanhystad
  (Fix it) Extend list with multiple other ones andreimotin 3 765 Aug-12-2024, 07:48 PM
Last Post: Pedroski55
  How returns behave in a function with multiple returns? khasbay 1 808 May-19-2024, 08:48 AM
Last Post: deanhystad
  Trying to generating multiple json files using python script dzgn989 4 2,189 May-10-2024, 03:09 PM
Last Post: deanhystad
  Python Project Structure for Modularity and Reusability with Multiple Entry Points b19wh33l5 0 1,360 Apr-24-2024, 12:21 PM
Last Post: b19wh33l5
  Using a script to open multiple shells? SuchUmami 9 3,275 Apr-01-2024, 10:04 AM
Last Post: Gribouillis
  __init__() got multiple values for argument 'schema' dawid294 4 9,456 Jan-03-2024, 09:42 AM
Last Post: buran
  Multiple variable inputs when only one is called for ChrisDall 2 1,213 Oct-20-2023, 07:43 PM
Last Post: deanhystad
  Can I use logging in a class (without multiple messages) mevan 2 1,303 Oct-16-2023, 11:08 PM
Last Post: mevan

Forum Jump:

User Panel Messages

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