I am trying to solve the following pattern:
And here is the code that I wrote:
limit = 10
for i in range(1, 12):
for j in range(i):
print(" "*j, end="")
if limit >= 0:
for j in range(0, limit):
print(j, end="")
limit -= 1
print()
But it is printing this weird pattern:
Aucun commentaire:
Enregistrer un commentaire