摘要: 一:例题 例题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 哎呦_不想学习哟~ 阅读(42) 评论(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 哎呦_不想学习哟~ 阅读(31) 评论(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 哎呦_不想学习哟~ 阅读(22) 评论(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 哎呦_不想学习哟~ 阅读(25) 评论(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 哎呦_不想学习哟~ 阅读(128) 评论(0) 推荐(0)