COMPSCI 61A Lecture Notes - Lecture 2: Eval
zogo39484755 and 6 others unlocked
22
COMPSCI 61A Full Course Notes
Verified Note
22 documents
Document Summary
Can use python for arithmetic, more interesting to use call expressions. Max can evaluate to a built in function. Names can evaluate to numbers or functions. Import function can be used to access certain names. Can create your own names, with assignment statement. Name = some expression, expression gets evaluated, name gets bounded to evaluated expression. Area, circle = pi*radius**2, 2*pi*radius, double assignment. Q: what does the = bind the name to, name binds to the value that the expression is evaluated to in the first place. Max is a function that takes max of arguments, also a value, built in function max. Reassign names, f = max, now f is bound to function max. Max(3,4) -> error, b/c max is not bound to function anymore f=max, now max() refers to two different functions, Max = f can turn max back into max. Assignment process: name = expression, expression evaluated to value(function, or number, name bound to value.