This list comprehension does not work:
buy_prices = [(buylow := round(0.997 + ii/10000.0, 5), max(jj, buylow)) for jj in [buylow, 0.9982] for ii in range(21)]
NameError: name 'buylow' is not defined
This one doesn't either:
buy_prices = [(buylow, max(jj, buylow)) for jj in [buylow := round(0.997 + ii/10000.0, 5), 0.9982] for ii in range(21)]
SyntaxError: assignment expression cannot be used in a comprehension iterable expression
How am I supposed to do this? Or do I just have to do the round calculation for buylow
twice?
I'd highly recommend not using nested list comprehensions, since that is not very readable to many people.
Instead maybe something like this: