1)
a = []
for i in range(10):
try:
na = int(input(f'Добавить элимент {i + 1}: '))
except ValueError:
print('Програма остановлена вы не вели число')
exit()
a.append(na)
for i in range(10-1):
for j in range(10-i-1):
if a[j] < a[j+1]:
a[j], a[j+1] = a[j+1], a[j]
print(a)
2)
_n = 0
A = [3, 5, 7]
N = 3
M = 4
P = 77
for x in range(N):
if max(A) < N:
break
else:
A.remove(A[-1])
_n += 1
for x in range(_n):
A.append(P)
print(A)
1)
a = []
for i in range(10):
try:
na = int(input(f'Добавить элимент {i + 1}: '))
except ValueError:
print('Програма остановлена вы не вели число')
exit()
a.append(na)
for i in range(10-1):
for j in range(10-i-1):
if a[j] < a[j+1]:
a[j], a[j+1] = a[j+1], a[j]
print(a)
2)
_n = 0
A = [3, 5, 7]
N = 3
M = 4
P = 77
for x in range(N):
if max(A) < N:
break
else:
A.remove(A[-1])
_n += 1
for x in range(_n):
A.append(P)
print(A)