Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 1. Въвеждаме брой символи на страната на ромба
- count_side = int(input())
- row_symb = 1 # брой символи на 1-ви ред
- # 2. Брой редове на горната част на ромба = брой символи на страната на ромба
- increase = count_side
- count_rows = count_side
- # 3. Брой интервали на 1-ви ред = брой редове - 1
- start_space = count_rows - 1
- count_space = count_rows - 1
- # 4. Общ брой символи на най-дългия ред = 2 * Брой редове - 1
- max_symbols_row: int = 2 * count_rows - 1
- # Общо символи
- total_sym = 1
- check = False
- # reverse = 1
- # start_col = 1
- # end_col = max_symbols_row + 1
- for row in range(1, count_rows + 1): # Брой редове for row in range(1, count_rows + 1):
- if check:
- break
- for col in range(1, max_symbols_row + 1): # Брой символи на ред
- if col > row:
- break
- print(' ' * count_space + '*' * row_symb, end='')
- count_space = count_space - 1
- row_symb += 2
- total_sim = total_sym + row_symb
- print()
- if row_symb > max_symbols_row:
- check = True
- break
- # Обратно
- check = False
- count_space = 1
- row_symb = max_symbols_row - 2
- for row in range(count_rows + 1, 2 * count_rows): # Брой редове for row in range(1, count_rows + 1):
- if check:
- break
- for col in range(max_symbols_row - 2): # Брой символи на ред
- if col > row:
- break
- print(' ' * count_space + '*' * row_symb, end='')
- count_space = count_space + 1
- row_symb -= 2
- total_sim = total_sym + row_symb
- print()
- if row_symb < 1:
- check = True
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement