Skip to content

Commit ae2114a

Browse files
committed
add loop
1 parent d310048 commit ae2114a

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
## 代码规范
77
* http://ssv.sebug.net/Python_Coding_Rule
8+
89
## 学习资源
910
* [简明 Python 教程](http://sebug.net/paper/python/index.html)
1011
* [crossin的编程教室](http://crossin.me/forum.php?mod=forumdisplay&fid=2)

loop.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# range(start, stop[, step])
2+
for i in range(0,5):
3+
print i;
4+
print '==============';
5+
6+
for i in range(0,5,2):
7+
print i;
8+
print '==============';
9+
10+
for i in [0, 1, 2]:
11+
print i;
12+
print '=====for end =========';
13+
14+
i = 0;
15+
while i < 5:
16+
print i;
17+
i+=1;
18+
19+
print '==============';
20+
21+
i = 0;
22+
while True:
23+
if i >= 5:
24+
break;
25+
else:
26+
i+=1;
27+
if i % 2 == 1:
28+
continue;
29+
print i;
30+
31+
print '==============';

0 commit comments

Comments
 (0)