Just a little holiday tree, would make a good exercise for beginning Python programmers.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Happy Holidays!
# with height = 5:
# *
# ***
# *****
# *******
# *********
# |
# Dependency: Python 3.3
height = 5
stars = 1
for i in range(height):
print((' ' * (height - i)) + ('*' * stars))
stars += 2
print((' ' * height) + '|')
|
Tags: exercise