How to solve this task with lists?

As chepner said, try write your own code without list comprehension and then modify your own code.

def pyramid(base, char):
  return [ ['']*num_empty + [char]*num_char + ['']*num_empty for num_empty, num_char in enumerate(list(range(base, 0, -2)))][::-1]

Browse More Popular Posts

Leave a Comment