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

2. Прочитайте условия задачи и напишите программный код. i. Дан массив B[N], состоящий из 6 элементов. Отсортируйте массив В по убыванию и запишите его в новый массив D.​

Ответы

Автор ответа: MagicSticks
1

Ответ:

B = [5, 2, 9, 1, 7, 3]   # исходный массив

D = sorted(B, reverse=True)   # сортировка по убыванию и запись в новый массив

print(D)   # вывод отсортированного массива D

Объяснение:

В данном примере мы создаем исходный массив B, состоящий из 6 элементов. Затем мы используем функцию sorted() для сортировки массива B в порядке убывания и записи отсортированных элементов в новый массив D. В параметре reverse=True мы указываем, что нужно сортировать в порядке убывания.

После этого мы выводим отсортированный массив D при помощи функции print().

Похожие вопросы
Предмет: Химия, автор: cherednicenko
Предмет: Английский язык, автор: lenakomarik
Diagnostic test 2
Past tenses
Underline the correct verb form in italics.
Example
The Incas didn't have/weren't having a written script.
1 The pool in the hotel was absolutely filthy so we didn't swam/swim in it.
2 We stoped/stopped at the first service station we came across.
3 The thieves ran out of the bank, jumped/were jumping into their car and sped away up the high street.
4 Rameses Il was ruling/ruled over ancient
Egypt for more than fifty years.
5 Intervention was urgently required - the starving children grew/were growing weaker by the day and there was/was being little sign of an end to the drought.
6 By the middle of the nineteen sixties many parts of Europe experienced/were experiencing a tremendous economic boom.
7 Jim left/was leaving on the early flight the next morning so he made his excuses and left the party before midnight.
8 Many of the survivors worked/were working in the fields when the earthquake struck.
9 Phil stood at the door soaked from head to toe; he had been running/was running in the rain.
10 Denise had to leave school early on
Wednesday because she took/was taking her driving test.
11 By the third month of the war rebel forces took/had taken most of the province.
12 At the time of the trial last summer Hinkley had been/was in prison for eight months.
13 We missed the first act of the play because when we arrived at the theatre the performance already started/had already started.
14 At midnight Mr Rochester had climbed/ climbed the stairs and went into his bedchamber.
15 The early rains were a disappointment as we expected/had expected to reach the coast before the monsoon set in.
16 At the time of the take-over the company's shares had declined/had been declining in value for several months.
17 Brendan was surprised to find the gas tank empty as he had only been using/had only used the truck twice that week.
18 Before the advent of satellite television viewers didn't used to haveluse to have a very wide selection of channels.
19 The staff were used/used to be paid weekly but now they receive a monthly salary.
20 Things have certainly changed - there would/belused to be loads of small shops around here when I was young.
Предмет: Английский язык, автор: 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