project_python/2.3_lesson.11.20.py
2025-12-15 13:56:49 +05:00

24 lines
1,008 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

****Задание 11 Параграф 2.3***
****
Каждая следующая укрепляет ваши навыки и уверенность. А теперь — немного математической классики.
Простые числа — это такие, у которых только два делителя: 1 и само число. В этой задаче вам нужно определить, сколько простых чисел назвали участники.****
if name == "main":
count = int(input())
simple_counter = 0
for i in range(count):
if (number := int(input())) > 1:
simple = True
divider = 2
while divider <= int(number ** 0.5) and simple:
if number % divider == 0:
simple = False
else:
divider = divider + 1
if simple is True:
simple_counter = simple_counter + 1
print(simple_counter)