Ответ написан в файле.
Через логическую связку and и or не получится проверял. Только построчно.
def main():
def check(marks):
for i in marks:
if i not in range(1,6):
normal = False
break
else:
normal = True
return normal
marks = list(map(int, input().split()))
normal = check(marks)
if normal:
if marks.count(3) >= 1:
print('NO')
else:
print('YES')
else:
print('input error. Mark can not be higher than 5 or lower than 1')
if __name__ == "__main__":
main()
end = input()
Не советую копировать, сайт нарушает табуляции в коде и по итогу интерпретатор выдаёт ошибку. Лучше попытаться понять и воссоздать самому
А В A&B A∨A&B<span>
0 0 0 0
0 1 0 0
1 0 0 1
1 1 1 1
1) A∨A&B</span>
что-то типа этого:
<span>const n = 8, m = 8;
var
A: array[1..n,1..m] of integer;
i, j, sum, product: integer;
isnotnull: boolean;
begin
randomize;
writeln('Случайная матрица:');</span><span> for i:=1 to n do begin
for j:=1 to m do begin
A[i,j] := random(51) - 25;
write(A[i,j]:5);
end;
writeln;
end;</span><span> sum := 0;
for i:=1 to n do
if A[i,n-i+1] < 0 then
sum := sum + A[i,n-i+1];
writeln('Сумма отрицательных элементов побочной диагонали = ', sum);</span><span> product := 1;
isnotnull := False;
for i:=1 to n-1 do
for j:=2 to n do
if (j > i) and (A[i,j] <> 0) then begin
isnotnull := True;
product := product * A[i,j];
end;
if isnotnull
writeln('Произведение ненулевых элементов в области выше главной диагонали = ', product)
else
writeln('Ненулевых элементов в области выше главной диагонали нет.', product);</span><span> readln;
end.</span>