摘要: ex36#分支和函数from sys import exit #导入system模块中的exit函数def gold_room(): #定义金子房间的函数 print("this room is full of gold,how much do you take?") next = input("> 阅读全文
posted @ 2017-09-28 22:39 laihefei 阅读(221) 评论(0) 推荐(0) 编辑
摘要: ex33 阅读全文
posted @ 2017-09-26 22:31 laihefei 阅读(180) 评论(0) 推荐(0) 编辑
摘要: ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__ 阅读全文
posted @ 2017-09-24 22:22 laihefei 阅读(112) 评论(0) 推荐(0) 编辑
摘要: ex28#布尔表达式练习True and True"test" == "test"1 == 1 or 2 != 1True or 1 == 1"test" == "testing"1 != 2 and 2 == 1"test" != "testing""test" == 1not(True and False)not(1 == 1 and 1 != 0)not(10 == 1 or 1000 ... 阅读全文
posted @ 2017-09-21 21:59 laihefei 阅读(117) 评论(0) 推荐(0) 编辑
摘要: ex24.py#更多练习print("let's practice everything.")print("you\'d need to know \' bout escapes with \\ that do \n newlines and \t tabs.")#\转义符,\'输出为',\\输出为\,\n输出为重新开始新一行,\t输出为tabs。poem = """ \t the ... 阅读全文
posted @ 2017-09-19 23:14 laihefei 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 习题22:到现在你学到了哪些?#到现在你学到了那些东西?print #输出def #定义函数argv #函数的参数list #列表,区别于元组,用[]表示utf-8 #一种编码,区别于GBKtuple #元组,区别于列表,用()表示,不能改变内部元素,但是可以改变内部元素的内部元素dict #字典, 阅读全文
posted @ 2017-09-18 22:12 laihefei 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 周末开始第一次尝试对着书写代码练习题 《笨办法学python》--作者Zed A.Shaw,翻译Wang Dingwei 阅读全文
posted @ 2017-09-17 20:44 laihefei 阅读(436) 评论(0) 推荐(0) 编辑