Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # *Crown Pattern* solution by @CodingComputing
- height = 7
- width = 2*height-1
- for row_num in range(1, height+1):
- if row_num <= height//2: # The "spikey" part of the crown
- edge_stars_num = row_num
- center_stars_num = 2*row_num - 1
- total_stars_num = 2*edge_stars_num + center_stars_num
- interim_spaces_num = (width - total_stars_num) // 2
- print(
- '*'*edge_stars_num + " "*interim_spaces_num +
- '*'*center_stars_num +
- " "*interim_spaces_num + '*'*edge_stars_num
- )
- else: # The "base" part of the crown
- print('*' * width)
- # Output:
- #
- # * * *
- # ** *** **
- # *** ***** ***
- # *************
- # *************
- # *************
- # *************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement