KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
var_list = [one, two, three] num = 1 for var in var_list: var = num num += 1 The above gives me an error that 'one' doesn't exist. Can you not assign in this way? I want to assign an incrementing number for each var in the list. So I want the equivalent of one = 1 two = 2 three = 3 but without having to manually create and initialize all variables. How can I do this?
Tags (comma-separated)
Save Edits
Cancel