I am trying to generate callable lists that looks like this:
Alist = [A1, A2, A3,..., An] Blist = [B1, B2, B3,..., Bn] Clist = [C1, C2, C3,..., Cn] ...
I tried:
N = 5
Lists = ["A","B","C","D"]
for j in Lists:
def jList(N):
lst = []
for i in range(n+1):
lst.append(j+str(i))
return(lst)
and this generates the correct lists, but it doeas not create the correct and callable name of the lists.
So it gives:[A1, A2, A3, A4, A5]
, but not AList = [A1, A2, A3, A4, A5]
As all the Names in the List are defined before (Let´s say A1 = 1, A2 = 2, A3 = 3, A4 = 4, A5 = 5
), i need to be able to call this numbers. So i need to call A[3]
and get "3" in return for making the code lines variable, which i hard coded so far.
I also tried an approach like:
N = 5
Lists = ["A","B","C","D"]
def createList(j,n):
lst = []
for i in range(n+1):
lst.append(j+str(i))
return(lst)
for j in Lists:
j+"List" = createList(j,N)
but this does not work.