1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
>>> 
>>> 
>>> x = 53
>>> y = 0
>>> y = 2
>>> while y < x:
	if x % y == 0:
		print 'not prime'

		

Traceback (most recent call last):
  File "<pyshell#48>", line 2, in <module>
    if x % y == 0:
KeyboardInterrupt
>>> while y < x:
	if x % y == 0:
		print 'not prime'
	y += 1

	
>>> x = 53
>>> y = 2
>>> x_is_prime = True
>>> while x % y:
	y += 1
else:
	x_is_prime = False

	
>>> x_si_prime

Traceback (most recent call last):
  File "<pyshell#60>", line 1, in <module>
    x_si_prime
NameError: name 'x_si_prime' is not defined
>>> x_is_prime
False
>>> 
>>> x = 53
>>> y = 2
>>> x_is_prime = True
>>> while x % y:
	y += 1
	if y == x:
		break
else:
	x_is_prime = False

	
>>> x_is_prime
True
>>>