python
lxqlxq21
这个作者很懒,什么都没留下…
展开
-
Python-2 Variables
http://www.codeskulptor.org/#examples-variables.py# variables - placeholders for important values# used to avoid recomputing values and to# give values names that help reader understand code原创 2015-05-26 23:46:58 · 252 阅读 · 0 评论 -
Python 3 -Functions
# computes the area of a triangledef triangle_area(base, height): # header - ends in colon,以冒号结尾 area = (1.0 / 2) * base * height # body - all of body is indented,body必须要退格 return area原创 2015-05-31 04:12:03 · 287 阅读 · 0 评论 -
Python 4- more operations
# Remainder - modular arithmetic# systematically restrict computation to a range# long division - divide by a number, we get a quotient plus a remainder# quotient is integer division //, the r原创 2015-06-01 03:55:03 · 346 阅读 · 0 评论 -
Python 5 -Logic
True (T)False (F)NOT AND OR-------------------------------------------------------------------------------------------------------------------------------------------------------------a=True原创 2015-06-01 04:25:17 · 474 阅读 · 0 评论 -
Python 6 - Conditionals
def greet(friend, money) if friend and (money > 20): print "Hi !" money= money -20 elif frined: #else if print "Hi !" else: print "Ha ha"原创 2015-06-01 04:35:12 · 318 阅读 · 0 评论 -
Python 7 - programming tips
用“”“ ”“”来添加help文件原创 2015-06-01 05:02:17 · 273 阅读 · 0 评论 -
Python 8 - Rock-paper-scissors-lizard-spock
Scissor > paperPaper > rockrock> lizardlizard > spockspock > scissorscissors > lizardlizard > paperpaper > spockspock > rockrock > scissors0-rock1-spock2-paper3-lizard4原创 2015-06-01 05:14:26 · 537 阅读 · 0 评论 -
Python-1 Arithmetic expressions
print 3,-1,3.14159,-2.8print type(3), type(3.14159) #print 数字的type,如int, float----------------------------------------------------------------------------------------------------------------原创 2015-05-24 10:58:37 · 489 阅读 · 0 评论 -
python常见注意事项
a=b是一个指向b的指针,因此修改a的时候,b也会发生变化。如果要从新建立一个a,要使用a=b.copy().原创 2015-12-09 01:03:22 · 517 阅读 · 1 评论