摘要: 1 1 # 3.3.1 使用方法sort() 对列表进行永久性排序 2 2 # 与字母顺序相反的顺序排列列表元素,为此,只需向sort() 方法传递参数reverse=True 。下面的示例将汽车列表按与字母顺序相反的顺序排列: 3 3 cars = ['bmw', 'audi', 'toyota' 阅读全文
posted @ 2019-02-18 00:02 波波皮球 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 1 bicycles = ['trek','connondale','redline','specialized'] 2 print(bicycles[0]) 3 4 bicycles = ['trek','connondale','redline','specialized'] 5 print(bicycles[0].title())#首字母大写 6 7 #... 阅读全文
posted @ 2019-02-16 21:04 波波皮球 阅读(186) 评论(0) 推荐(0) 编辑
摘要: #day11#expandtabs 断句20 如果占用20个字就不用填充 反之可用/t来填充test = "username\temail\tpassword\nlaiying\tlaiasd@qq.com\t123\nlaiying\tlaiasd@qq.com\t123\nlaiying\tla 阅读全文
posted @ 2019-02-15 00:30 波波皮球 阅读(84) 评论(0) 推荐(0) 编辑
摘要: 1 #用户登录(三次机会重试) 2 #老师答案(最后两行自添) 3 count = 0 4 while count >>') 6 pwd = input('>>>') 7 if user == 'alex' and pwd == '123': 8 print('欢迎登录') 9 print('..........') 10 ... 阅读全文
posted @ 2019-02-13 20:45 波波皮球 阅读(80) 评论(0) 推荐(0) 编辑
摘要: while count <= 10 : if n == 7 : #冒号不要忘记 1 #1.输出100以内的所有偶数 2 """ 3 #自己代码 4 count = 0 5 while count < 101: 6 7 count = count + 1 8 if count % 2 == 0: 9 阅读全文
posted @ 2019-02-12 22:34 波波皮球 阅读(79) 评论(0) 推荐(0) 编辑