Answer the question
In order to leave comments, you need to log in
How to write a minimum divisor problem?
Given an integer not less than 2. Print its least natural divisor different from 1.
When you first enter a number less than 2, and then more than two, it gives an error
. And when you immediately enter a number greater than two, everything is fine
b = 1
while True:
a = int (input())
b = b + 1
if a % b == 0:
print(b)
break
else:
if a < 2:
print("Error!")
continue
Answer the question
In order to leave comments, you need to log in
else:
if a < 2:
print("Ошибка!")
continue
def small_div(num):
if num < 2:
return f'Число не соответствует условию задачи: {num} < 2'
for i in range(2, num+1):
if not num%i:
return i
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question