0

im presently trying to loop over a list of names and assign each to a letter ie a variable. Im aware of the enumerate function however i wondered if i cn do this with letters? The purpose of this is for a little project where i will insert these new assignments into an api request that provides stock info on various companies. The idea is to amalgamate information via an automated calling function and i can perform some math on the results as a whole. so just to clarfiy ive a list of compnaies and i want to assign the name to a letter so i can inject this into an api call (an subsequesnt loop) to get information. Many thanks

example: for company in companies: a = compnay one

www.financialinfo.com//(a)apikey=ty7ouipu.... etc

Chris H
  • 1
  • 1
  • 3
    Variable names generally shouldn't be treated as data in your program. If they're variables, they're for you, the programmer to type in. Programatically creating them is not their purpose. If you want to associate one-character strings with some data, use a dictionary. See [this previous question and its answers](https://stackoverflow.com/questions/1373164/how-do-i-create-variable-variables) for more (including how you can do what you're specifically asking for, as well as why it's a bad idea). – Blckknght Jun 04 '22 at 20:02

0 Answers0