![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
cs61a课程学习记录
cs61a课程学习记录
joeychiang
这个作者很懒,什么都没留下…
展开
-
关于书籍“Composing Programs”1.6.3自定义函数的嵌套定义与非嵌套定义的比较
最近在刷UCB的CS61A2018年的课程,用的配套书籍是John DeNero的“Composing Programs”,书籍1.6.3部分讲到user_defined function的qian'tao原创 2021-06-17 11:34:58 · 220 阅读 · 0 评论 -
关于CS61A的Lab3中Interleaved Sum的答案
Write a function interleaved_sum that similarly computes the sum of a sequence of terms from 1 to n, but uses different functions to compute the terms for odd and even numbers. Do so without using any loops or testing in any way if a number is odd or even.原创 2021-11-21 10:44:42 · 686 阅读 · 0 评论 -
Lab 03: Recursion and Midterm Review
Q3: WWPD: Call Expressions原创 2021-11-20 08:54:02 · 212 阅读 · 0 评论 -
关于Homework03的Church numerals的代码
Church numerals是一个很有意思的问题,cs61a的homework03中的Q7就是跟Church numerals有关的。在做这道题的过程中,我首先自己写出了答案并且测试通过,然后找了下官方的答案,没想到官方的代码如此的简短,思考之后令人不得不拍手称赞。因此,此篇文章我将分三部分:第一部分贴出我自己的代码,第二部分贴出官方的代码,第三部分会简单比较下我写的代码与官方的代码,并就官方的代码中使用的lambda方法尝试进行解读,如有错误,敬请各位批评指正。一、我自己写的代码def zer原创 2021-11-19 19:14:46 · 671 阅读 · 2 评论 -
Lab 02: Lambda Expressions and Higher-Order Functions
Q1: WWPD: Lambda the Free原创 2021-11-12 23:06:04 · 90 阅读 · 0 评论 -
Project 1: The Game of Hog
Problem 0原创 2021-11-08 19:55:32 · 150 阅读 · 0 评论 -
lab01 Expressions & Control
Q1:WWPD:VeritasinessQ2:WWPD:LoopsQ6:WWPD:ThuthinessQ7:WWPD:What If?原创 2021-11-08 16:15:14 · 95 阅读 · 0 评论 -
python代码测试的两种思路
工具:pycharm2020.3.4 x64一、使用Assertions进行测试代码:def sum_naturals(n): """return the sum of the first n natural numbers""" total, k = 0, 1 while k <= n: total, k = total+k, k+1 return totaldef sum_naturals_test(): assert原创 2021-11-03 10:35:01 · 403 阅读 · 0 评论 -
lab00 Introduction & Workflow
打算刷一遍加州伯克利的cs61a的课程。由于可以通过"run ok"来评估lab做的是否ok,但没有找到提交lab的途径,于是索性把"run ok"的结果记录在这里。原创 2021-10-11 21:12:40 · 74 阅读 · 0 评论