I just started to study Python on the Sirius platform. I was able to solve all other problems from the topic & laquo; While & raquo;, besides one task that does not allow me to go on the following topics. The task & laquo; the minimum simple divisor of the number & raquo;.
Condition: gives an integer that is no less than 2. Bring its smallest simple divisor. You can not use additional libraries (math, etc.)!
Input data: The whole positive number of n & lt; = 2*10 in the 9th degree.
Output: display the response to the task.
tried Decide by writing a code with While, but my answer is not counted, due to the program for too long. It is recommended that you organize a cycle that sorting out the dividers to the root from the n:
my code Python (issues an error & laquo; the program was executed for too long and was interrupted & raquo; or & laquo; program; gives an error in the process of execution & raquo;):
n = int ( input ()) i = 2 when i & lt; = n: if%i! = 0 : i += 1 print (i) I can not understand what the error is?
question@mail.ru
·