摘要: from sys import exitdef gold_room(): print "This room is full of gold. How much do you take?" next = raw_input("> ") if "0" in next or "1" in... 阅读全文
posted @ 2014-10-25 15:33 林中细雨 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 自己的几个list常用用法。mylist = [i for i in range(10)]mylist.pop(-1)mylist.append(9)mylist_1 = [i for i in range(10,20)]mylist_2 = zip(mylist, mylist_1)mylist.... 阅读全文
posted @ 2014-10-25 11:21 林中细雨 阅读(178) 评论(0) 推荐(0) 编辑
摘要: while用起来不如for安全。i = 0numbers = []while i < 6: print "At the top i is %d" % i numbers.append(i) i = i + 1 print "Numbers now: ", numbers print "At ... 阅读全文
posted @ 2014-10-25 11:06 林中细雨 阅读(127) 评论(0) 推荐(0) 编辑
摘要: the_count = [1, 2, 3, 4, 5]fruits = ['apples', 'oranges', 'pears', 'apricots']change = [1, 'pennies', 2, 'dimes', 3, 'quarters']# this first kind of f... 阅读全文
posted @ 2014-10-25 10:47 林中细雨 阅读(182) 评论(0) 推荐(0) 编辑