Ответ:
mat = [[' '] * 7 for _ in range(7)]
n = input('Введите букву от а до к\n')
match n:
case 'а':
for i in range(7):
for j in range(7):
if (i < j and i < 7 - 1 - j) or (i < j and i > 7 - 1 - j):
mat[i][j] = '*'
case 'б':
if (i > j and i < 7 - 1 - j) or (i > j and i > 7 - 1 - j):
case 'в':
if i < j and i < 7 - 1 - j:
case 'г':
if i > j and i > 7 - 1 - j:
case 'д':
if (i > j and i > 7 - 1 - j) or (i < j and i < 7 - 1 - j):
case 'е':
if (i > j and i < 7 - 1 - j) or (i < j and i > 7 - 1 - j):
case 'ж':
if i > j and i < 7 - 1 - j:
case 'з':
if i < j and i > 7 - 1 - j:
case 'и':
if (i < j and i < 7 - 1 - j) or (i > j and i < 7 - 1 - j):
case 'к':
if (i > j and i > 7 - 1 - j) or (i < j and i > 7 - 1 - j):
case _:
raise ValueError('по русскому написано, от а до к')
for i in mat: print(*i)
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
mat = [[' '] * 7 for _ in range(7)]
n = input('Введите букву от а до к\n')
match n:
case 'а':
for i in range(7):
for j in range(7):
if (i < j and i < 7 - 1 - j) or (i < j and i > 7 - 1 - j):
mat[i][j] = '*'
case 'б':
for i in range(7):
for j in range(7):
if (i > j and i < 7 - 1 - j) or (i > j and i > 7 - 1 - j):
mat[i][j] = '*'
case 'в':
for i in range(7):
for j in range(7):
if i < j and i < 7 - 1 - j:
mat[i][j] = '*'
case 'г':
for i in range(7):
for j in range(7):
if i > j and i > 7 - 1 - j:
mat[i][j] = '*'
case 'д':
for i in range(7):
for j in range(7):
if (i > j and i > 7 - 1 - j) or (i < j and i < 7 - 1 - j):
mat[i][j] = '*'
case 'е':
for i in range(7):
for j in range(7):
if (i > j and i < 7 - 1 - j) or (i < j and i > 7 - 1 - j):
mat[i][j] = '*'
case 'ж':
for i in range(7):
for j in range(7):
if i > j and i < 7 - 1 - j:
mat[i][j] = '*'
case 'з':
for i in range(7):
for j in range(7):
if i < j and i > 7 - 1 - j:
mat[i][j] = '*'
case 'и':
for i in range(7):
for j in range(7):
if (i < j and i < 7 - 1 - j) or (i > j and i < 7 - 1 - j):
mat[i][j] = '*'
case 'к':
for i in range(7):
for j in range(7):
if (i > j and i > 7 - 1 - j) or (i < j and i > 7 - 1 - j):
mat[i][j] = '*'
case _:
raise ValueError('по русскому написано, от а до к')
for i in mat: print(*i)