Listing 08-26: Printing a list of integers with multiple levels

##############################################################################
# Python From Scratch
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2024
# Site: https://pythonfromscratch.com
#
# File: listing\chapter 08\08.26 - Printing a list of integers with multiple levels.py
# Description: Printing a list of integers with multiple levels
##############################################################################

def print_lists(list_to_print, level=0):
    for x in list_to_print:
        if type(x) is int:
            print(f"{x:{level * 2}}")
        else:
            print_lists(x, level + 1)
Click here to download the file