+ 2
Why this code says x not defined in line 5
def add_numbers(x, y): total = x + y return total print("This won't be printed") print(x*y) k=5;l=8 print(add_numbers(k, l))
3 odpowiedzi
+ 5
Because it's outside the function and you can't access local variable outside the function.
+ 2
i think, anything after return won't be printed
+ 1
Because x & y is local variable , they only accessable in the function body.