-3

I want to make some list, each one named as an element in another list.

Input: ["A","B","C"]

The output that I want:

A = []
B = []
C = [] 
Alireza
  • 5
  • 2

1 Answers1

1

While this can be done by modifying the vars() dict, I would suggest just using a separate dict for that:

lists  = dict()
names = ["A","B","C"]

for name in names:
    lists[name] = []
    
adjan
  • 13,371
  • 2
  • 31
  • 48