ответ:A№1
mass = [int(input()) for i in range(5)]
for i in mass:
if i % 3 == 0 and i % 10 == 8:
print(i, end=' ')
№2
from random import randint
mass = [randint(100, 999) for i in range(100, 1000)]
for i in range(len(mass) - 1):
for j in range(i + 1, len(mass)):
if mass[i] % 100 > mass[j] % 100:
mass[i], mass[j] = mass[j], mass[i]
print(mass)
№3
mass = [randint(0, 1000) for i in range(1000)]
if mass[i] == mass[-1]:
B№1
k = 0
if str(i)[0] == '8':
k += 1
print(k)
if sum(map(int, str(mass[j]))) < sum(map(int, str(mass[i]))):
k = mx = 0
for i in range(1, len(mass)):
if mass[i] * mass[k] > mx:
mx = mass[i] * mass[k]
max_i, max_k = i, k
print(max_k, max_i)
Объяснение:
не знаю сколько чисел должно быть в массиве в интервале от 0, 1000
если надо изменить, то поменять в range(1000) на нужное кол-во чисел
using namespace std;
int main()
{
int a = 0, b = 0, c = 0;
int h = 0, g = 0, k = 0;
int j = 0, v = 0, l = 0;
cout << "a - chas" << "\n" << "b - minutes" << "\n" << "c - seconds" << "\n";
cin >> a >> b >> c;
cout << "h - chas" << "\n" << "g -minutes" << "\n" << "k - seconds" << "\n";
cin >> h >> g >> k;
j = ((a*60)*60)+(b*60)+c;
v = ((h*60)*60)+(g*60)+k;
l = v - j;
cout << l;
}
ответ:A№1
mass = [int(input()) for i in range(5)]
for i in mass:
if i % 3 == 0 and i % 10 == 8:
print(i, end=' ')
№2
from random import randint
mass = [randint(100, 999) for i in range(100, 1000)]
for i in range(len(mass) - 1):
for j in range(i + 1, len(mass)):
if mass[i] % 100 > mass[j] % 100:
mass[i], mass[j] = mass[j], mass[i]
print(mass)
№3
from random import randint
mass = [randint(0, 1000) for i in range(1000)]
for i in range(len(mass) - 1):
if mass[i] == mass[-1]:
print(i, end=' ')
B№1
mass = [int(input()) for i in range(5)]
k = 0
for i in mass:
if str(i)[0] == '8':
k += 1
print(k)
№2
from random import randint
mass = [randint(100, 999) for i in range(100, 1000)]
for i in range(len(mass) - 1):
for j in range(i + 1, len(mass)):
if sum(map(int, str(mass[j]))) < sum(map(int, str(mass[i]))):
mass[i], mass[j] = mass[j], mass[i]
print(mass)
№3
from random import randint
mass = [randint(0, 1000) for i in range(1000)]
print(mass)
k = mx = 0
for i in range(1, len(mass)):
if mass[i] * mass[k] > mx:
mx = mass[i] * mass[k]
max_i, max_k = i, k
k += 1
print(max_k, max_i)
Объяснение:
не знаю сколько чисел должно быть в массиве в интервале от 0, 1000
если надо изменить, то поменять в range(1000) на нужное кол-во чисел