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

решение нужно в ПИТОНЕ
15.2 Напишите программу, которая в последовательности натуральных чисел определяет количество чисел, оканчивающихся
на 3. Программа получает на вход количество чисел в последовательности, а затем сани числа. В последовательности всегда
имеется число, оканчивающееся на 3. Количество чисел не превышает 1000. Введенные числа не превышают 30 000.
Программа должна вывести одно число — количество чисел, оканчивающихся на 3.
Пример работы программы:
Входные данные выходные данные
3
13
23
2
24
Источник: ГИА

Ответы

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

Ответ:

def convertToInt(str: str) -> int:

   try:

       return int(str)

   except Exception:

       exit()

def main() -> None:

   lenNumberArray = convertToInt (

       input(

           "количество чисел: "

       )

   )

   #условия  Количество чисел не превышает 1000

   if not(0 < lenNumberArray < 1000):

       exit()

   numbers = [

       input(

           f"число {i+1}: "

       ) for i in range(lenNumberArray)

   ]

   howNumberEnd3 = 0

   for i in numbers:

       #условие Введенные числа не превышают 30 000.

       if convertToInt(i) > 30000:

           exit()

       

       if i.replace(" ", "")[-1] == "3":

           howNumberEnd3 += 1

   #Программа должна вывести одно число — количество чисел, оканчивающихся на 3.

   print(f"чисел которие заканчиваются на 3: {howNumberEnd3}")

if __name__ == "__main__":

   main()

Объяснение:

примерчик

>>> python main.py

количество чисел: 5

число 1: 3

число 2: 13

число 3: 23

число 4: 2

число 5: 24

чисел которие заканчиваются на 3: 3

Похожие вопросы
Предмет: Английский язык, автор: Адочка1
There has (0) ..A…. a fascination with the planet Mars ever since science fiction began to be written (1)……..

novels about beautiful Martian princesses or three-headed invaders became a successful way to make

readers (2) …………a world of the imagination. Now, there is even a Mars Society whose members have recreated Martian conditions on Earth. Devon Island (3)………… in the Canadian Arctic, a vast area which

(4) ……… mountains, cliffs and canyons like those on Mars. There is even a massive crater. Scientists are

(5) …………..advantage of these similar conditions to (6) …………………whether it would be possible for human

beings to live on Mars. On Devon Island, the volunteers are getting used (7) ………space suits all the time.

They have to withstand the extreme temperatures that are also found on Mars. In fact, Mars is not so

different from our own planet as most people (8)…………. . There are four distinct seasons and the sun rises

and (9)…………….. to create days and nights similar in length to ours. In the past, there must have been life on

Mars; scientists have discovered river beds where water (10) ……..and evidence that living organisms once

existed there. Then the systems that supported life (11) ………... Perhaps a giant asteroid hit the planet and

increased its distance from the sun so that temperatures dropped and Mars (12)…….. a dead, frozen planet.

0 A been B be C to be D being

1 A Produce B Having produced C To producing D Producing

2 A to enter B enter C entering D to be enter

3 A lies B lays C is lying D is laying

4 A is possessing B is possessed C possesses D possessions

5 A putting B getting C making D taking

6 A see B be seeing C finding out D be discover 7 A to wear B to be wearing C to wearing D to be worn

8 A imagined Bare imagining C imagine D imagination

9 A sets B is falling C downs D falls

10 A was used to run B used to running C was used to running D used to run

11 A fell down B did wrong C broke down D broke

12 A turned from B turned into C turned down D turned up










SILK PRODUCTION

Large-scale production of silk (0) ..A.. on huge 'farms' of a certain kind of moth. A cocoon of fine threads of

silk (1) ….by the silkworm, which is the grub of this moth. This cocoon is a small tubular structure designed by

nature for the grub (2)…….. while it develops.

The cocoons are transferred from the farm to the factory, where, (3)………. peeled by machines, they (4)…… in

large tanks of warm water in order to (5) ……………the tightly woven silk. In the next step, the threads of silk (6)

……off by hand-operated machines. This part of the process is known as 'reeling' and can only (7)…… out by

highly experienced staff. Silk production in the factory (8) ……… by the raising of the silkworms themselves on

the farm. As soon as the eggs (9) ……..by the female moths, they are stored in incubators. The grubs (10)

…………. .only on mulberry leaves which are only available at a certain time of the year. Thus, the eggs (11)

………to promote hatching, so that the silkworms are born at the same time as the leaves become ready (12)

……..picked.

0 A depends B is depended C has been depended D is depend

1 A is spinning B is spinned C is spun D are spun

2 A to protect B to be protected C to be protect D to be protecting

3 A being B been C having been D having

4 A are floated Bare float C floated D have been floated

5 A be remove B be loosened C loosen D loosening

6 A are wound B are winding C have wound D has been wound

7 A carry out B be carry out C be carrying out D be carried out

8 A is precede B is proceeded C is preceded D had preceded

9 A are lay B are laid C has been laid D have been layed

10 A are feed B are feeds C are fed Dare being fed

11 A must be heat B must be hot C must be heated D must to be heated

12 A to B to have been C to be D to be being
помогите пожалуйста...


Предмет: Другие предметы, автор: вита200218
Предмет: Қазақ тiлi, автор: alina4556