for i in range(3):
for j in range(5):
print("* ", end="")
print("")
* * * * *
* * * * *
* * * * *
for i in range(5):
for j in range(i + 1):
print("* ", end="")
print("")
*
* *
* * *
* * * *
* * * * *
for i in range(5):
for j in range(4 - i):
print(" ", end="")
for j in range(i + 1):
print("* ", end="")
print("")
*
* *
* * *
* * * *
* * * * *
total = 0
count = 0
for i in range(10):
for j in range(i + 1):
total = total + (i * j)
count += 1
print(f"sum: {total}, count: {count}")
for i in range(5):
for j in range(i + 1):
print("* ", end="")
print("")
![](/intro-python/images/05/output.png)