from random import randint
n = int(input("Input n: "))
su = 0
mu = 1
for i in range(1, n+1):
for j in range(1, n+1):
a = randint(0, 10)
print(a, end=" ")
if j>i:
su+=a
if j<=n-i:
mu*=a
print()
print(f"sum = {su}, mu = {mu}")
Объяснение:
from random import randint
n = int(input("Input n: "))
su = 0
mu = 1
for i in range(1, n+1):
for j in range(1, n+1):
a = randint(0, 10)
print(a, end=" ")
if j>i:
su+=a
if j<=n-i:
mu*=a
print()
print(f"sum = {su}, mu = {mu}")
Объяснение: