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 ▸

How do I use format python code?


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


Create a program that takes in two numbers and returns the highest of the two


What's the difference between a local and a global variable?