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
Answered by Nikolai M. Python tutor

1691 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

Create a program that generates prime numbers between two integer boundareis


Write a Python script to take a product name as input and then automatically google search reviews for it and open the top 3 search results in different tabs


What is the difference between a float and an integer variable type?


What can I do with Python?


We're here to help

contact us iconContact ustelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo

MyTutor is part of the IXL family of brands:

© 2026 by IXL Learning