Python Forum
Best way to accommodate unknown number of variables?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Best way to accommodate unknown number of variables?
#7
instead of a bunch of different variable names, i'd make a (big) list:
mylist = howmany*[initialvalues]
then i can access each one by its index. if i need to access some specific one in the code i can just hard code the index like mylist[0] first the first one.
ndc85430 and Mark17 like this post
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
RE: Best way to accommodate unknown number of variables? - by Skaperen - May-21-2022, 11:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Create X Number of Variables and Assign Data RockBlok 8 1,153 Nov-14-2023, 08:46 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

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