Control Print and None Pure functions just returns a value. None-pure functions have a side effect. Print is a none-pure function that always returns None, but also displays a given value. ...
CS61A: Lecture 3
CS61A: Lecture 3
Control Print and None Pure functions just returns a value. None-pure functions have a side effect. Print is a none-pure function that always returns None, but also displays a given value. ...
CS61A: Higher-Order Functions
Higher-Order Functions Allow to design functions with very general methods of computation A function that takes another function as an argument Generalizing Patterns with Arguments For ce...
CS61A: Control
Control Control statements such as if and while control which portions of code are executed, when they are executed, and how many times. If Statements and Call Expressions Every clause is c...
CS61A: Iteration
Iteration The act of repeating things. In programming, we use loops to perform iteration. While Statements Compound statement that contains a condition (header) and a suite of expressions...
CS61A: Conditional Statements
Statements Statements are executed by the interpreter to perform an action A Compound Statement is a statement that can span over multiple lines. A Clause is a single header followe...
CS61A: Multiple Environments
Multiple Environments Tracing a User-Defined Function Code Behind the Scenes Def Statement A new function is created! The name is bounded to the ...
CS61A: Miscellaneous Python Features
Overview Operators Multiple Return Values Docstrings Doctests Default Arguments Operators Shorthand notation for calling builtin functions. from operator import add, mul (2+3*4+5...
CS61A: Conditional Statements
Statements Statements are executed by the interpreter to perform an action A Compound Statement is a statement that can span over multiple lines. A Clause is a single header followe...
CS61A: Print and None type
Forethought Consider >>> -2 -2 >>> print(-2) -2 There is a difference in the two. The print function and the None value Python has rules for automatically displaying values o...