Академический Документы
Профессиональный Документы
Культура Документы
to
understand
bindings
Environments
are
formalism
for
tracking
bindings
of
variables
and
values
Assignments
pair
name
and
value
in
environment
Asking
for
value
of
name
just
looks
up
in
current
environment
Python
shell
is
default
(or
global)
environment
Deni?ons
pair
func?on
name
with
details
of
func?on
x = 5! x p = 3! p ! result result = 1! ! for turn in range(p):! print('iteration: ' + str(turn) + 'current str(result))! result = result * x!
5 3 1
result: ' +
x = 5! x p = 3! p ! result result = 1! ! for turn in range(p):! print('iteration: ' + str(turn) + 'current str(result))! result = result * x!
5 3 125
result: ' +
Back
to
func?ons
x = 5! x
y = 3! y
! max
def max(x, y):! if x > y:! return x! else:! return y! 5
3
E2 x y