I'm at the very beginning with Python so my knowledge is quite noob level.
Anyway, I have found this example online:
for num in range(10,20): #to iterate between 10 to 20
for i in range(2,num): #to iterate on the factors of the number
if num%i == 0: #to determine the first factor
j=num/i #to calculate the second factor
print(f"{num} equals {i} * {j}")
break #to move to the next number, the #first FOR
else: # else part of the loop
print(f"{num} is a prime number")
break
Here the result from the example:
10 equals 2 * 5
11 is a prime number
12 equals 2 * 6
13 is a prime number
14 equals 2 * 7
15 equals 3 * 5
16 equals 2 * 8
17 is a prime number
18 equals 2 * 9
19 is a prime number
Unfortunately by running that code on Jupyter it returns:
10 equals 2 * 5
11 is a prime number
12 equals 2 * 6
13 is a prime number
14 equals 2 * 7
15 is a prime number ### THIS IS THE ERROR
16 equals 2 * 8
17 is a prime number
18 equals 2 * 9
19 is a prime number
I can't really find the error here, any advice?