Do you want 'push each '|' into array' or want expected output?
You can approach this from different angle and without any complicated indices handling:
If you want to be able skip some symbols in rows then you can simply:
You can approach this from different angle and without any complicated indices handling:
def pyramide(lines): for line in range(lines+1): print(f'{" |" * line:^{lines * 2}s}') pyramide(5) | | | | | | | | | | | | | | |You should keep in mind that all functions what don't return or yield anything from body will return None.
If you want to be able skip some symbols in rows then you can simply:
def pyramide(lines, row, qty): for line in range(lines+1): if line == row: print(f'{" |" * (line - qty):^{lines * 2}s}') else: print(f'{" |" * line:^{lines * 2}s}') pyramide(7, 5, 2) | | | | | | | | | | | | | | | | | | | | | | | | | |Both functions print empty line at first line, to get rid of that use range(1, lines+1)
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.