# Nested list comprehension nested_list = [[_ + __ for _ in range(5)] for __ in range(3)] print(nested_list) [[0, 1, 2, 3, 4], [1, 2, 3, 4, 5], [2, 3, 4, 5, 6]]