21 lines
475 B
Python
Executable file
21 lines
475 B
Python
Executable file
#!/usr/bin/env python
|
|
|
|
"""Dessine une pyramide d'étoiles selon un entier N donné, N étant impair"""
|
|
|
|
|
|
def main() -> None:
|
|
for line in reversed(creer_pyramide(9, [])):
|
|
print(line)
|
|
|
|
|
|
def creer_pyramide(N: int, pyramide: list[str]) -> list[str]:
|
|
if N == 0:
|
|
return pyramide
|
|
else:
|
|
nombre_etoiles = 2 * N - 1
|
|
pyramide.append("*" * nombre_etoiles)
|
|
return creer_pyramide(N - 1, pyramide)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|