Предмет: Информатика, автор: temirbaevvadim

3. Дан одномерный массив В[N], длиной в 9 элементов. Вставьте в конец этого массива элемент, равный 500, удалите элемент, равный 10. Найдите количество элементОВ массива, равных (​

Ответы

Автор ответа: sme41691
0

# Исходный массив

B = [1, 2, 3, 4, 5, 6, 7, 8, 10]

# Добавляем элемент 500 в конец

B.append(500)

# Удаляем элемент, равный 10

B.remove(10)

# Считаем количество элементов, равных 2

count = B.count(2)

# Выводим результаты

print("Массив после добавления и удаления элементов:", B)

print("Количество элементов, равных 2:", count)

Вывод программы:

Массив после добавления и удаления элементов: [1, 2, 3, 4, 5, 6, 7, 8, 500]

Количество элементов, равных 2: 1

Похожие вопросы
Предмет: Химия, автор: cherednicenko
Предмет: Математика, автор: Аноним
Предмет: Английский язык, автор: bogryashovaanastasya
Пожалуйста, помогите.
1. They spoke so quickly that I... what they were speaking about.
a) not understand;
b) don't understand;
c) didn't understand;
d) hadn't understood.
2. Yesterday our flight... because of the fog.
a) cancelled
b) was cancelled
c) had been cancelled
d) has been cancelled
3.The Vikings... to North America a thousand years ago.
a) sail
b) sailed
c) had sailed
d) have sailed
4.Thank you for your offer. But I... not to accept it.
a) decide
b) has decided
c) have decided
d) decided
5. You... through your old photograph album for half an hour already.
a) look
b) are looking
c) have looked
d) have been looking
6. Nobody knows where his picture is. Perhaps it....
a) was stolen
b) will be stolen
c) has been stolen
d) stolen
7. I agree. You ... apologize for not inviting him to your birthday party.
a) can't
b) mustn't
c) shouldn't
d) may not
8. Actually,today I feel... than I did yesterday.
a) bad
b) worse
c) worst
d) the worst
9. ... people who are unemployed often feel depressed.
a) the
b) -
c) a
d) that
10. Who was the first astronaut who landed on... Moon?
a) the
b) -
c) a
d) those
11. What happened at the end of the film? -I'm sorry to say, but I haven't seen... film.
a) a
b) the
c) -
d) those
12. This is... interesting exhibition I've ever visiting.
a) more
b) most
c) less
d) the most
13. Would you mind waiting... minutes?
a) few
b) a few
c) little
d) a little
14. I'm... interested in languages than in mathematics.
a) much
b) many
c) little
d) less
15. The students often translate English texts... Russian.
a) to
b) in
c) into
d) on