Question: Write a recursive function that takes a list and indentation level as input and prints each item in a pretty format. The pretty format should

Write a recursive function that takes a list and indentation level as input and prints each item in a "pretty" format. The "pretty" format should be as follows:
Print an opening square bracket [indented (4* indentation level) spaces]
Print each item in the list on its own line [indented (4*(indentation level +1)) spaces]
If the item is a string, print double quotes around itIf the item is another list, pretty print that list (increase indentation level by 1)Include a comma after the item unless it is the last item in the list
Print a closing square bracket [indented (4* indentation level) spaces]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!