摘要: 摘录自官方文档:https://docs.python.org/2/library/dis.html回头自己也脑补下。可以使用dis查看自己代码的复杂度之类的东西。比如while 1 和while True哪个效率更高。定义两个方法,分别使用while循环def w() : while 1 :... 阅读全文
posted @ 2014-11-06 23:49 Kairong 阅读(585) 评论(0) 推荐(0) 编辑
摘要: 32-33章节 将for-loop和while-loop循环的。俩种句法就不说了。简单说下个人对于for和while的理解。我觉得他learn python the hard way这里的写法是,先说相同点: 1、都可以一次操作都不做,for-loop如果集合为空,while后面的条件为false... 阅读全文
posted @ 2014-11-06 23:31 Kairong 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 题目中给出的代码如下:def break_words(stuff): """This function will break up words for us.""" words = stuff.split(' ') return wordsdef sort_words(word... 阅读全文
posted @ 2014-11-06 21:38 Kairong 阅读(460) 评论(0) 推荐(0) 编辑
摘要: In the function ex5 write code that will input a line of text, split it into words, and display thesewords one per line, and also print the length o... 阅读全文
posted @ 2014-11-06 20:29 Kairong 阅读(266) 评论(0) 推荐(0) 编辑