Use recursion to print all the sublists of a given list

def withoutIndex (lst, i): return lst[ : i] + lst[i + 1 : ]def printSublists(lst): print(lst) for i in range(len(lst)): printSublists(withoutIndex(lst, i))printSublists([1, 2, 3])

NM

Related Python Mentoring answers

All answers ▸

What is the outcome of the following code? print(2*[3,4,5])


Which four data types are used in Python? Can you give an example of each?


Using the shared code editor, write a recursive function for calculating a factorial of an input parameter.


Explain how python programs are structured and give an example of how methods are initiated