摘要: 代码如下: 点击查看代码 # coding=utf-8 the_count = [1, 2, 3, 4, 5] fruits = ['apple', 'oranges', 'pears', 'apricots'] change = [1, 'pennies', 2, 'dimes', 3, 'qua 阅读全文
posted @ 2022-10-08 07:48 TiramisuPS 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 代码如下: 点击查看代码 # coding=utf-8 print "You enter a dark room with two doors. Do you go through door #1 or door #2?" # 你将进入一个有两扇门的黑暗房间。你是从 1 号门还是 2 号门进去的? 阅读全文
posted @ 2022-10-08 07:21 TiramisuPS 阅读(50) 评论(0) 推荐(0) 编辑
摘要: 代码如下: 点击查看代码 people = 30 cars = 40 buses = 15 if cars > people: print "We should take the cars." elif cars < people: print "We should not take the car 阅读全文
posted @ 2022-10-08 06:24 TiramisuPS 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 代码如下: 点击查看代码 people = 20 cats = 30 dogs = 15 if people < cats: print "Too many cats! The world is doomed!" if people > cats: print "Not many cats! The 阅读全文
posted @ 2022-10-08 05:51 TiramisuPS 阅读(42) 评论(0) 推荐(0) 编辑
摘要: 代码如下: 点击查看代码 a = True and True print "The result of 'True and True' is", a b = False and False print "The result of 'False and False' is", b c = 1 == 阅读全文
posted @ 2022-10-08 05:36 TiramisuPS 阅读(35) 评论(0) 推荐(0) 编辑
摘要: 根据原代码进行修改,使其可以运行。 原代码: 点击查看代码 def break_words(stuff): """This function will break up words for us.""" words = stuff.split(' ') return words def sort_w 阅读全文
posted @ 2022-10-08 04:39 TiramisuPS 阅读(30) 评论(0) 推荐(0) 编辑
摘要: 尝试将自己写的方法作为模块进行导入。 ex25.py 代码如下: 点击查看代码 # coding=utf-8 # 更多更多的练习 def break_words(stuff): # 定义 stuff 函数 """This function will break up words for us.""" 阅读全文
posted @ 2022-10-08 03:49 TiramisuPS 阅读(47) 评论(0) 推荐(0) 编辑
摘要: 代码如下: 点击查看代码 # coding=utf-8 # 更多更多的练习 def break_words(stuff): # 定义 stuff 函数 """This function will break up words for us.""" words = stuff.split(' ') r 阅读全文
posted @ 2022-10-08 02:46 TiramisuPS 阅读(20) 评论(0) 推荐(0) 编辑