728x90
기본 선언
n = 700
print(n)
print(type(n))
print()
출력 값
700
<class 'int'>
동시 선언
x = y = z = 700
print(x,y,z)
# 선언
var = 75
출력 값
700 700 700
Change Value
재 선언
var = "Change Value"
print(var)
print(type(var))
print()
출력 값
Change Value
<class 'str'>
# Object References
# 변수 값 할당 상태
# 1. 타입에 맞는 오브젝트 생성
# 2. 값 생성
# 3. 콘솔 출력
print(300)
print(int(300))
print(n, type(n))
print()
m = n
print(m, type(m))
print()
출력 값
777 <class 'int'>
777 <class 'int'>
id 확인 : 객체의 고유한 확인
m = 800
n = 655
print(id(m))
print(id(n))
print(id(m) == id(n))
print()
출력 값
2239434750224
2239434750096
False
m = 800
n = 800
print(id(m))
print(id(n))
print(id(m) == id(n))
print()
출력 값
2239434750224
2239434750224
True
예약어는 변수명으로 불가능
False def if raise
None del import return
True elif in try
and else is while
as except lambda with
assert finally nonlocal yield
break for not
class from or
continue global pass
'python' 카테고리의 다른 글
python 공부 3일차 - 3 (0) | 2020.12.23 |
---|---|
python 공부3일차 - 2 (0) | 2020.12.22 |
python 공부 3일차 (0) | 2020.12.22 |
python 공부 1일차 (0) | 2020.12.21 |
python 설치하기 (0) | 2020.12.21 |