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 difference between & and && operators?


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


Define a function that takes in the age of the user and adds it to an output sentence such as "You are ..... old".


Make a program that asks the user for a series of numbers until they either want to output the average or quit the program.