摘要: # -*- coding: utf-8 -*-"""Created on Fri Oct 24 19:32:45 2014@author: dell"""# -*- coding: utf-8 -*-"""Created on Fri Oct 17 09:14:25 2014generate fig... 阅读全文
posted @ 2014-10-24 19:46 林中细雨 阅读(320) 评论(0) 推荐(0) 编辑
摘要: print "You enter a dark room with two doors. Do you go through door #1 or door #2?"door = raw_input("> ")if door == "1": print "There's a giant bear ... 阅读全文
posted @ 2014-10-24 16:08 林中细雨 阅读(162) 评论(0) 推荐(0) 编辑
摘要: if __name__ == '__main__': a = 100 if a > 90: print "90" elif a > 80: print '80' elif a > 70... 阅读全文
posted @ 2014-10-24 15:55 林中细雨 阅读(126) 评论(0) 推荐(0) 编辑
摘要: people = 20cats = 30dogs = 15if people cats: print "Not many cats! The world is saved!"if people dogs: print "The world is dry!"dogs += 5if people... 阅读全文
posted @ 2014-10-24 15:48 林中细雨 阅读(157) 评论(0) 推荐(0) 编辑
摘要: def break_words(stuff): """This function will break up words for us.""" words = stuff.split(' ') return wordsdef sort_words(words): """Sorts t... 阅读全文
posted @ 2014-10-24 15:20 林中细雨 阅读(125) 评论(0) 推荐(0) 编辑
摘要: print "Let's practice everything." print 'You\'d need to know \'bout escapes with \\ that do \n newlines and \t tabs.'poem = """\tThe lovely worldwith... 阅读全文
posted @ 2014-10-24 15:06 林中细雨 阅读(212) 评论(0) 推荐(0) 编辑
摘要: In cases like this, where the independent variable does not have an intrinsic ordering, it isoften a good idea to sort entries by the dependent variab... 阅读全文
posted @ 2014-10-24 11:11 林中细雨 阅读(258) 评论(0) 推荐(0) 编辑
摘要: def add(a, b):print "ADDING %d + %d" % (a, b)return a + bdef subtract(a, b):print "SUBTRACTING %d - %d" % (a, b) return a - bdef multiply(a, b): ... 阅读全文
posted @ 2014-10-24 09:57 林中细雨 阅读(195) 评论(0) 推荐(0) 编辑
摘要: from sys import argvscript, input_file = argvdef print_all(f): print f.read() def rewind(f): f.seek(0)def print_a_line(line_count, f): pri... 阅读全文
posted @ 2014-10-24 09:46 林中细雨 阅读(177) 评论(0) 推荐(0) 编辑
摘要: def cheese_and_crackers(cheese_count, boxes_of_crackers): print "You have %d cheeses!" % cheese_count print "You have %d boxes of crackers!" % boxes... 阅读全文
posted @ 2014-10-24 09:41 林中细雨 阅读(161) 评论(0) 推荐(0) 编辑