Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import floor
- num_row = int(input())
- count_row_symbols = num_row
- if not num_row % 2:
- count_stars_first_row = 2
- num_row -= 1
- midd_space = 2
- else:
- count_stars_first_row = 1
- midd_space = 1
- next_num_row = num_row - 1
- # First row
- count_space_left = int((num_row - 1) / 2) # 1-vi red
- print('-' * count_space_left + '*' * count_stars_first_row + '-' * count_space_left)
- # Next rows
- for row in range(1, next_num_row):
- if row <= floor(num_row / 2):
- count_space_left -= 1
- count_space_right = count_space_left
- print('-' * count_space_left + '*' + '-' * midd_space + '*' + '-' * count_space_right)
- midd_space += 2
- else:
- if row == floor((num_row / 2)) + 1:
- midd_space -= 4
- count_space_left += 1
- count_space_right = count_space_left
- print('-' * count_space_left + '*' + '-' * midd_space + '*' + '-' * count_space_right)
- midd_space -= 2
- # Last row
- if num_row >2:
- count_space_left = int((num_row - 1) / 2) # 1-vi red
- print('-' * count_space_left + '*' * count_stars_first_row + '-' * count_space_left)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement