Python

Python

Python for

for iterating_var in sequence: for iterating_var in sequence: statements(s) statements(s)

Python while

while expression: while expression: statement(s) statement(s)

whilefor forwhile

2~100

#!/usr/bin/python # -*- coding: UTF-8 -*- i = 2 while(i < 100): j = 2 while(j <= (i/j)): if not(i%j): break j = j + 1 if (j > i/j) : print i, " " i = i + 1 print "Good bye!"

:

2 
3 
5 
7 
11 
13 
17 
19 
23 
29 
31 
37 
41 
43 
47 
53 
59 
61 
67 
71 
73 
79 
83 
89 
97 
Good bye!