from operator import add, sub def a_plus_abs_b(a, b): """Return a+abs(b), but without calling abs. >>> a_plus_abs_b(2, 3) 5 >>> a_plus_abs_b(2, -3) 5 """ if b < 0: f = sub else: f = add return f(a, b) def a_plus_abs_b_syntax_check(): """Check...
网址https://inst.eecs.berkeley.edu/~cs61a/fa21/hw/hw03/ problem1:用递归,一边判断当前的数字,一边加上除了当前的数字判断函数 peoblem2:这个函数的意思是从1到n,每一次加一,如果碰到数字中有8的数字或者可以整除数字8的则讲加一改为每次减一,此次类推,下次则把减一改为加一。 problem3:这个函数是输入一...
网址https://inst.eecs.berkeley.edu/~cs61a/fa21/disc/disc14/ 目录 problem1: problem2: problem3: problem4: probelm5: probelm 6: problem7: problem9and10 problem1: 就是两种情况考虑,然后加起来就好了 defpaths(x, y):"""Return a list of ways to reach y from x by repeated incrementing...
CS61a总共4个project,10个homework,14个discussion,14个lab,38个lecture,261个视频。 我从10月31日到1月11日,总共用了72天学完(几乎)所有可以得到的材料(刚开始的一个月只学了65小时)。学了最长时间的那天是2021年12月31号...在CS61a上用了6小时四十五分钟。有记录的学习时间共计229.08小时,详细数据(Google...
cs61a2021fallhw02 from operator import add, mul square = lambda x: x * x identity = lambda x: x triple = lambda x: 3 * x increment = lambda x: x + 1 HW_SOURCE_FILE = __file__def product(n, term):"""Return the product of the first n terms in a sequence.n: a positi...
Repository files navigation README cs61A-2021Fall hw and lab About No description, website, or topics provided. Resources Readme Activity Stars 0 stars Watchers 0 watching Forks 0 forks Report repository Releases 1 tags Packages No packages published Languages JavaScript 71.7% Python ...
Code Issues Pull requests My labs, homework, and projects for UC Berkeley CS61A, Summer 2024 cs61a Updated Jul 11, 2024 Python cy-Yin / UCBerkeley-CS61A-Fall2023 Star 21 Code Issues Pull requests Discussions This repo contains all the materials and solutions of UC Berkeley CS 61...
cs61a2021falllab04 HW_SOURCE_FILE = __file__def summation(n, term):"""Return the sum of numbers 1 through n (including n) wíth term applied to each number.Implement using recursion!>>> summation(5, lambda x: x * x * x) # 1^3 + 2^3 + 3^3 + 4^3 + 5^3 225 >>>...
p22 Homework 2. Recursion Hint 25:13 p23 Lecture 10. Containers 46:08 p24 Lecture 10. Q&A 39:28 p25 Lecture 11. Data Abstraction 37:55 p26 Lecture 11. Q&A 34:46 p27 Project 2. Cats Hint 45:05 p28 Lecture 12. Trees 43:31 p29 Lecture 12. Q&A 27:13 p30 Lecture 13...
2021 cs61a fall hw10 网址https://inst.eecs.berkeley.edu/~cs61a/fa21/hw/hw10/ BNF: rstring: "r\"" regex* "\"" ?regex:character|word|group|pipe|class|quantsgroup: "(" regex*")" pipe: regex "|" regexcharacter: LETTER|NUMBER...