Skip to content

Commit d310048

Browse files
committed
add if
1 parent ee9c14b commit d310048

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
## sublime插件
44
* [SublimeREPL](https://github.com/wuub/SublimeREPL) 允许你在编辑界面直接运行 Python 解释器;以及执行python文件。
55

6-
## 资源
6+
## 代码规范
7+
* http://ssv.sebug.net/Python_Coding_Rule
8+
## 学习资源
9+
* [简明 Python 教程](http://sebug.net/paper/python/index.html)
710
* [crossin的编程教室](http://crossin.me/forum.php?mod=forumdisplay&fid=2)
811
* [dive into python](http://www.diveintopython.net/toc/index.html)
912
* [learn python the hardway](http://learnpythonthehardway.org/book/)

hello-world.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#!/usr/bin/python
22
#coding:utf-8
33
#上面两行是解决文件中 中文的问题
4-
print 'python is so cool~';
54
print 'why do you think python is cool?';
65
answer = raw_input();
7-
print 'your answer is ';
8-
print answer;
9-
print ' is so cool~'
6+
print 'your answer is: ', answer, ' is so cool~';

if.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/python
2+
#coding:utf-8
3+
from random import randint
4+
num = randint(1, 10);
5+
# print num;
6+
answer = int(raw_input('输入一个数字: '));
7+
while True:
8+
if num == answer:
9+
print '猜对啦';
10+
break;
11+
elif answer > num:
12+
print '猜大啦~'
13+
else:
14+
print '猜小啦';
15+
16+
answer = int(raw_input('输入一个数字: '));

0 commit comments

Comments
 (0)