project_python/2.3_lesson.19.20.py

17 lines
912 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

****Задание 19 Параграф 2.3***
**** Ох, дети растут быстро и становятся всё требовательнее — даже змейки им теперь кажутся скучными!
Воспитательница в панике, но вы уже здесь — и готовы придумать что-то новенькое.
На этот раз им хочется увидеть числовой квадрат, который будто состоит из слоёв — как матрёшка из чисел.
Выглядит эффектно, а строится... проще, чем кажется! ****
if name == "main":
size = int(input())
cell_width = len(str((size + 1) // 2))
for i in range(size):
for j in range(size):
print(f'{min(i + 1, j + 1, size - i, size - j):>{cell_width}}', end=' ')
print()