COMPSCI 61A Lecture Notes - Lecture 2: Eval

30 views3 pages
zogo39484755 and 6 others unlocked
COMPSCI 61A Full Course Notes
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.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents