Python Forum
Iterating over dictionaries with the namedtuple function (PyBite #108)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Iterating over dictionaries with the namedtuple function (PyBite #108)
#8
(Jul-09-2020, 02:01 PM)Drone4four Wrote:
   test = (BY[0]*BY[1] + BO[0]*BO[1] + BG[0]*BG[1] + BB[0]*BB[1])

Note that the good thing about using namedtuple is that the fields in the object can be accessed by name, as well as index. I suggest using the former, because it helps make your code more readable.
Reply


Messages In This Thread
RE: Iterating over dictionaries with the namedtuple function (PyBite #108) - by ndc85430 - Jul-15-2020, 04:23 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Dictionary lookups exercise (PyBite #109) Drone4four 14 8,768 Aug-10-2020, 06:41 PM
Last Post: Intr0spective
  Type conversion and exception handling (PyBite #110) Drone4four 5 42,305 Jul-27-2020, 11:33 AM
Last Post: DeaD_EyE
  "Slicing and dicing strings" - - PyBite #105 Drone4four 8 6,289 Jun-11-2020, 09:28 PM
Last Post: knackwurstbagel
  Help with homework problem - iterating a function midnitetots12 4 4,525 Feb-21-2018, 10:51 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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