#전역변수 global : 함수 밖에서 정의한 변수
name = '주현아'
def hello():
print(name + ' 안녕!')
hello()
print(name)
#전역변수는 어디서든 사용할 수 있다
#지역변수 local : 함수 안에서 만든 변수
def bye():
animal = '강아지'
print(animal + ' 잘 가')
bye()
#print(animal)
#지역변수는 함수 안에서만 사용할 수 있다!!
x = 5 #전역변수
def add():
y = 3 #지역변수
print('x + y =', x + y)
add()
print(x)
#print(y)
print('----문제----')
juice = '???'
def make_juice():
juice = '???'
print('안에서 만든 주스 :', juice)
make_juice()
print('밖에서 만든 주스 :', juice)
To embed this project on your website, copy the following code and paste it into your website's HTML: