I have the following for loop in C that I want to mimic in Python:
for (index = 0; index < n; ++index)
{
for (i = 0, j = index; j < n; ++i, ++j)
{
'do something'
}
}
Is there a more elegant/Pythonic way to do this, or do I have to declare a variable outside of the loop like so:
for index in range(m):
i = 0
for j in range(index, m):
'do something'
i += 1
indexis just going be used as the bounds of my loop andiandjare going to be the indices to a nested list that I want to populate.