Python Forum
Need help improving function that reads file into list of tuples
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help improving function that reads file into list of tuples
#2
I don't understand the logic you're doing in the final section.

At line 53, you run the section only if damages is already a float. I would imagine if it's already a float you would want to leave it alone.

At line 56/57, if damages is set to some non-zero value, you change it to be a zero. Why?

In several places you say int('0'). Why not just say 0 instead?
Reply


Messages In This Thread
RE: Need help improving function that reads file into list of tuples - by bowlofred - Nov-02-2020, 11:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Adding values with reduce() function from the list of tuples kinimod 10 2,799 Jan-24-2023, 08:22 AM
Last Post: perfringo
Question convert unlabeled list of tuples to json (string) masterAndreas 4 7,557 Apr-27-2021, 10:35 AM
Last Post: masterAndreas
  Count number of occurrences of list items in list of tuples t4keheart 1 2,417 Nov-03-2020, 05:37 AM
Last Post: deanhystad
  Improving my understanding of functions and methods menator01 2 2,197 Apr-24-2020, 06:26 AM
Last Post: menator01
  Dictionary and tuples list comprehensions help paul41 2 2,440 Nov-29-2019, 06:59 PM
Last Post: perfringo
  Writing list as a file, then reading that file as a list Zoastria_Balnala 3 2,670 Oct-17-2019, 07:54 PM
Last Post: Zoastria_Balnala
  I created a function that generate a list but the list is empty in a new .py file mrhopeedu 2 2,361 Oct-12-2019, 08:02 PM
Last Post: mrhopeedu
  Converting List into list of tuples ARV 4 4,845 Sep-28-2019, 04:58 AM
Last Post: perfringo
  Improving code to autorename if filename exists Den0st 5 3,032 Sep-23-2019, 07:53 AM
Last Post: wavic
  reading txt file putting in list function Expel 7 3,861 Jul-17-2019, 03:18 PM
Last Post: Expel

Forum Jump:

User Panel Messages

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