4 ms·
Iteration is just recursion over a list/array/generator.
by pwdisswordfish9 4y ago
Iteration is just recursion over a list/array/generator.
- alecbz 4y agoI don't know if that's a helpful framing? def sum(arr): total = 0 for x in arr: total += x return total and def sum(arr): if len(arr) == 0: return 0 return arr[0] + sum(arr[1:]) both operate over an array but I'd call one of them recursive and the other iterative.