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 ▸

Write a recursive function to return the nth Fibonacci number in Python


Explain why creating a list of several instances of one element using something like my_list = [a] * 5 can result in strange behaviour


Write a recursive function that takes any integer n and prints the nth Fibonacci number.


Create a python code to sum the number from 1 to 10.