자바스크립트에서 아래처럼 쓰면
id = 0
function test(){
id = 11;
console.log(id);
};
console.log(id);
test();
console.log(id);
0
11
11
답이 으로 나오고
파이썬에서 똑같이 식을 쓰면
id = 0
def test():
id = 11
print(id)
print(id)
test()
print(id)
0
11
0
으로 나옵니다
왜 다른건지 알수있을까요?
뭐라고 검색하면 더 알아볼수있을까요?