I wrote a code that takes a list and a starting point that, but if the starting point is not given I want it to start at 0. The problem I have is that I want it to iterate from the start (0) to the end (len(a_list)-1), however I don't know how to keep start going up by one each time until it has iterated through everything.
Here is a small crappy example:
def test(a_list, start = 0):
final = []
for i in a_list[start]:
final.append(i)
return final
print (test([[1,2,3,4],[2,3,4]]))
This outputs: [1, 2, 3, 4]
Whereas I want it to output [1, 2, 3, 4, 2, 3, 4]
without changing the print (test([[1,2,3,4],[2,3,4]]))
and assuming the start point is not given how would i go about achieving this.
Thanks