Answer the question
In order to leave comments, you need to log in
Why is this code throwing an error?
Hello, I am a beginner in programming. I would like to understand why in the first code it does not give an error, but in the second it does?
x = 50
def func(x):
print('x равен', x)
x = 2
print('замена локального x на', x)
func(x)
print('x по прежнему', x)
x = 50
def func():
print('x равен', x)
x = 2
print('замена локального x на', x)
func()
print('x по прежнему', x)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question