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

Определить, есть ли в последовательности из n целых случайных чисел от 1 до 100, число, равное k. Если есть, вывести на экран номер, под которым оно встречается впервые, а если нет – вывести слово «Нет». помогите!!

Ответы

Автор ответа: Grey0808
3

Вот на языке Python:

from random import randint

count = int(input('Введите длину последовательности => '))

massiv = [randint(1, 100) for i in range(count)]

print('Массив', massiv)

num = int(input('Введите какое число надо найти => '))

position = 1

for i in massiv:

if i == num:

print('Число имеет',position, 'позицию')

exit()

position += 1

print('Такого числа там нет')

Вопрос только насчёт номера числа. Если тебе надо считать с 0, 1 и т.д., то измени position с 1 на 0.

Я сделал, чтобы счёт числа шёл с одного, дальше сам решай.

Похожие вопросы
Предмет: Английский язык, автор: Foreverson
Еще перевод одного текста)


Television is the most popular leisure pastime in Russia. Several television channels are in operation: "Ostankino". "Russian Channel", "Independent TV Channel - NTV". Besides them there are local TV channels and local commercial TV channels in big cities and republics of Russia.

TV services provide programmes of general interest such as light entertainment, sport, current affairs, serious drama, music. There are programmes on arts, children's and family programmes, interview with outstanding personalities, news reports covering international, national and local events.

Much attention is paid to foreign films, American in particular, foreign TV programmes and soap operas.

Television in Britain.

Television is one of the most popular mass media in Britain. About 96 per cent of population have television in their homes. It is estimated that about 10 per cent of household have two or more sets. Average viewing time per person is over 17 hours a week.

Four television channels are in operation: BBC-1. BBC-2. ITV. Channel-4.

The BBC has been providing regular television broadcasts since 1936. BBC television productions come from main studios at the Television Centre in west London and other studios in various parts of London.

The first regular independent television broadcast began in London in 1955. Independent television programmes are produced at 18 studio centres throughout the country.

Вот, ток не Googloвский))
30 баллов
Предмет: Математика, автор: наташка27
Предмет: Английский язык, автор: Foreverson
Нужен перевод, желательно адекватный, а не Googlовский)

We talk to various people from different countries about their attitudes about TV. Does TV educate or stimulate? Or it is a drug or tranquilizer used to control the population? There are different points of view, e.g. “TV has been the greatest instrument of social democracy in Western European socialites”, - said Mr. Smith from British film institute. Some people disagree, 90 % of TV programmes in some countries are foreign. And some people think and feel that TV has disrupted local culture and social ties. Why do developing countries introduce TV? Perhaps government do it for prestige, to show that they have introduced new technology into their societies. Another possible reason is that political leaders want their people to see them on TV.

TV is a very expensive medium and many countries don’t have the technology and the money to make their own television programmes. The result is that most countries are dependent on TV of Britain and America. It is easier and cheaper to buy foreign products mainly soap operas. So, a lot of people feel that TV is a danger to local cultures in some countries.

How do people usually answer the question: “What are you going to do tonight?” or “What are you going to do at the weekend?” In other words how do people spend their free time.

Some 20 or 30 years ago the usual answers used to be “We are going to the theatre” or “We are going to the party” or “We are having some friends round”. Now you are very often hear “We are going to stay at home and watch the television”.

A first-rate colour TV set has become an ordinary thing in the household today and a video cassette recorder is quickly becoming one. Modern TV offers viewers several programmes on different channels. In addition to regular newscasts you see plays and films, operas and ballets and watch all kinds of contests, quizzes and sporting events. You can also get a lot of useful information of the educational channels. A good serial can keep the whole family infront of the TV for days, and don’t we spend hours and hours watching our favorite football and hockey term in an important international event.

In the conclusion we may say, TV most definitely plays a very important part in people’s life, but is this a good thing or a bad one? Don’t we go out less often, then we used to? Don’t we read less?

30 баллов)
Предмет: Физика, автор: Егорка156