λ³Έλ¬Έ λ°”λ‘œκ°€κΈ°

University of California, Berkeley/ElectricalEngineering & ComputerSciences

(48)
LAB_day 3 Structure of Recursion: Base case - Base case(s) : simple problems that we have answers to trivially - Base case(s) stops the program from going to Case study _ factorial Q What is the simplest case that I know the answer to ? A 0! is 1 by definition. 1! is also 1 by definition Is there any simple
Recursion Examples Order of Recursive Calls Goal : print out a cascading tree of a positive integer n Ideas : - If n is a single digit, just print it out ! - Otherwise, let cascade ( n // 10 ) take care of the middle and print(n) around it The cascade function : Each cascade frams is from a different call to cascade : Until the Return value appears, that call has not completed : Any statement can appear before or ..
textbook _ final Week 5 http://composingprograms.com/pages/25-object-oriented-programming.html 2.5 Object-Oriented Programming 2.5 Object-Oriented Programming Object-oriented programming (OOP) is a method for organizing programs that brings together many of the ideas introduced in this chapter. Like the functions in data abstraction, classes create abstraction barriers between t composingprograms.com http://comp..
textbook _ mid Week 1 http://composingprograms.com/pages/11-getting-started.html 1.1 Getting Started Chapter 1: Building Abstractions with Functions 1.1 Getting Started Computer science is a tremendously broad academic discipline. The areas of globally distributed systems, artificial intelligence, robotics, graphics, security, scientific computing, comp composingprograms.com http://composingprograms.com/pages/..
Recursion Review : Abstraction Describing Functions : A function's domain is the set of all inputs it might possibly take as arguments : A function's range is the set of output values it might possibly return : A pure function's behavior is the relationship it creates between input and output Functional Abstraction Mechanics : How does python execute this program line-by-line : What happens when you evalu..
LAB_day 2 Lambdas - define functions lambda : - almost identical to def-statement except : no intrinsic name : limited to 1 expression python codes ex. def add_three(x) : return x + 3 python codes ex. add_three = lambda x: x+3 Higher Order Functions - Functions that either : takes in a function as an argument : returns a function python codes ex. def lemon(bar): def ice(cream): return bar + cream return ice
Higher-Order Functions Higher-Order Function : Functions are first-class, meaning they can be manipulated as values A higher-order function is 1. A function that a function as an argument 2. A function that returns a functionas a return value Describing Function : A function's domain is the set of all inputs it might possibly take as arguments : A function's range is the set of output values it might possibly return :..
Week 2 Week 2 Resources https://sequoia-tree.github.io/techniques-in-computer-science/booleans.html Booleans Recall True and False are the two booleans in Python. It turns out they're pretty handy. For instance, what if we want to do something, but only if a particular condition is True? What if we want to repeat something until that condition is False? These sor sequoia-tree.github.io https://sequoia-..