Is it possible to add/reduce number of nested for loops in a function based on the length of input?
For example: Based on a certain input of length 3, I may need to use 1 nested for loop (for loop inside another for loop). Similar to this,
for i in range(0, len(input)+1):
for j in range(i+1, len(input)+1):
However, when the input length is 4, I could have achieved my result if I could introduce additional for loop inside the already existing nested for loop, which means,
for i in range(0, len(input)+1):
for j in range(i+1, len(input)+1):
for k in range(j+1, len(input)+1):`
Similarly, if the input length is 5, then I would like to introduce another for loop,
for i in range(0, len(input)+1):
for j in range(i+1, len(input)+1):
for k in range(j+1, len(input)+1):
for l in range(k+1, len(input)+1):`
The pattern is, there will be n-1 number of for loops for an input of length n.
Is it possible create such a function in Python?