02 2023 档案

摘要:Q1 题目描述: 代码实现: 1 def coords(fn, seq, lower, upper): 2 """ 3 >>> seq = [-4, -2, 0, 1, 3] 4 >>> fn = lambda x: x**2 5 >>> coords(fn, seq, 1, 9) 6 [[-2, 阅读全文
posted @ 2023-02-19 20:47 哎呦_不想学习哟~ 阅读(90) 评论(0) 推荐(0) 编辑
摘要:一:例题 例题1: 题目描述: #递归算法def g(n): """Return the value of G(n), computed recursively. >>> g(1) 1 >>> g(2) 2 >>> g(3) 3 >>> g(4) 10 >>> g(5) 22 >>> from co 阅读全文
posted @ 2023-02-15 23:00 哎呦_不想学习哟~ 阅读(32) 评论(0) 推荐(0) 编辑
摘要:1 def cond(): 2 "*** YOUR CODE HERE ***" 3 return False 4 5 def true_func(): 6 "*** YOUR CODE HERE ***" 7 print(42) 8 9 10 def false_func(): 11 "*** Y 阅读全文
posted @ 2023-02-15 20:23 哎呦_不想学习哟~ 阅读(26) 评论(0) 推荐(0) 编辑
摘要:题目描述: 代码: 1 def num_eights(x): 2 """Returns the number of times 8 appears as a digit of x. 3 4 >>> num_eights(3) 5 0 6 >>> num_eights(8) 7 1 8 >>> num 阅读全文
posted @ 2023-02-15 20:17 哎呦_不想学习哟~ 阅读(13) 评论(0) 推荐(0) 编辑
摘要:题目描述: A guest at a party is a celebrity if this person is known by every other guest, but knows none of them. There is at most one celebrity at a part 阅读全文
posted @ 2023-02-15 12:06 哎呦_不想学习哟~ 阅读(19) 评论(0) 推荐(0) 编辑
摘要:1 def cycle(f1, f2, f3): 2 """Returns a function that is itself a higher-order function. 3 4 >>> def add1(x): 5 ... return x + 1 6 >>> def times2(x): 阅读全文
posted @ 2023-02-14 21:19 哎呦_不想学习哟~ 阅读(105) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示