I have a list, called checkerlist[] containing n items.
Here's how the values look (incrementally rises by 1):
check0 = result['ask'].iloc[0]
check1 = result['ask'].iloc[1]
and so on.
Essentially, I want to execute each line inside a for loop:
for ask in checkerlist:
eval(ask)
However, I get this error:
File "<string>", line 1
check0 = result['ask'].iloc[0]
^
SyntaxError: invalid syntax
But if I were to run
check0 = result['ask'].iloc[0]
check0
I would get the desired result: 2.5
What am I doing wrong?
For reference- I hadn't originally had this code inside a list, just printed it out as is. However, adding it to a list has made it far more manageable (I'm still learning python). So any best practices you feel you can share will be well received.