上一页 1 ··· 355 356 357 358 359 360 361 362 363 ··· 403 下一页
摘要: >>> a = ["aa","bb","cc","dd","ee","ff","gg","hh"] >>> a ['aa', 'bb', 'cc', 'dd', 'ee', 'ff', 'gg', 'hh'] >>> a.pop() ## pop删除  阅读全文
posted @ 2021-02-24 08:10 小鲨鱼2018 阅读(78) 评论(0) 推荐(0)
摘要: >>> a = ["aa","bb","cc"] ## 创建列表 >>> a ['aa', 'bb', 'cc'] >>> a.append("dd") ## append添加 >>> a ['aa', 'bb', 'cc', 'dd'] >>> a.extend(["ee"]) >> 阅读全文
posted @ 2021-02-24 08:06 小鲨鱼2018 阅读(588) 评论(0) 推荐(0)
摘要: 1、 >>> a = list(range(1,11)) ## 生成列表 >>> a [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] >>> a[::-1] ## 倒序排列 [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] >>> a [1, 2, 3, 4, 5, 6 阅读全文
posted @ 2021-02-23 22:33 小鲨鱼2018 阅读(5252) 评论(0) 推荐(0)
摘要: 1、>>> a = ["aa","bb","cc","dd"] ## 生成列表 >>> a ['aa', 'bb', 'cc', 'dd'] >>> a = [] ## 清空列表 >>> a []2、 >>> a = ["aa","bb","cc","dd"] ## 生成列表 > 阅读全文
posted @ 2021-02-23 22:25 小鲨鱼2018 阅读(468) 评论(0) 推荐(0)
摘要: >>> a = list(range(1,21)) ## 生成列表 >>> a [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] >>> a[::2] ## 提取第奇数元素 [1, 3, 5, 7, 9, 阅读全文
posted @ 2021-02-23 22:22 小鲨鱼2018 阅读(8000) 评论(0) 推荐(0)
摘要: >>> a = list(range(1,21)) ##生成列表 >>> a [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] >>> a[:10] ## 提取前10个元素 [1, 2, 3, 4, 5, 阅读全文
posted @ 2021-02-23 22:19 小鲨鱼2018 阅读(17754) 评论(0) 推荐(0)
摘要: 1、 >>> a = ["aaa","bbb","ccc","ddd"] >>> b = reversed(a) >>> c = [] >>> for i in b: c.append(i) >>> c ['ddd', 'ccc', 'bbb', 'aaa'] 2、 >>> a = ["aaa"," 阅读全文
posted @ 2021-02-22 17:54 小鲨鱼2018 阅读(483) 评论(0) 推荐(0)
摘要: 1、 aaa = "123" answer = input("please input the answer:") while True: if answer == aaa: break answer = input("please input the answer,again:") print(" 阅读全文
posted @ 2021-02-16 19:38 小鲨鱼2018 阅读(148) 评论(0) 推荐(0)
摘要: 1、for 循环 >>> sum = 0 >>> for i in range(101): sum += i >>> print(sum) 5050 2、while循环 >>> sum = 0 >>> i = 0 >>> while i <= 100: sum += i i += 1 >>> pri 阅读全文
posted @ 2021-02-15 22:07 小鲨鱼2018 阅读(5493) 评论(0) 推荐(0)
摘要: 1、 # prize test age = 20 score = "A" if age < 18: if score == "A": print("congratulations!!!") else: print("score not A!!!") else: print("age excess 1 阅读全文
posted @ 2021-02-06 23:06 小鲨鱼2018 阅读(103) 评论(0) 推荐(0)
上一页 1 ··· 355 356 357 358 359 360 361 362 363 ··· 403 下一页