Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
hallymer
Python_Basic
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
Python_Basic
/
chapter02_02.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
104 lines (84 loc) · 1.8 KB
master
Breadcrumbs
Python_Basic
/
chapter02_02.py
Copy path
Top
File metadata and controls
Code
Blame
104 lines (84 loc) · 1.8 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Chapter02-2
# 파이썬 완전 기초
# 파이썬 변수
# 기본 선언
n = 700 #변수의 값을 할당한다.
# 출력
print(n)
print(type(n)) #type함수는 변수 n에 있는 값의 자료형을 보여준다.
print()
# 동시 선언
x = y = z = 700
print(x, y, z)
print()
# 선언
var = 75
# 재선언
var = "Change Value"
# 출력
print(var)
print(type(var))
# Object References
# 변수 값 할당 상태
# 1. 타입에 맞는 오브젝트 생성
# 2. 값 생성
# 3. 콘솔 출력
# 예1)
print(300)
print(int(300))
# 예2)
# n -> 777
n = 777
print(n, type(n))
print()
m = n # n의 값을 m에 대입
# m -> 777 <- n
print(m, n)
print(type(m), type(n))
print()
m = 400
print(m, n)
print(type(m), type(n))
print()
# id(identity)확인 : 객체의 고유값 확인
m = 800
n = 655
print(id(m))
print(id(n))
print(id(m)==id(n))
print()
# 같은 오브젝트 참조
# 변수를 재사용하거나 똑같은 값을 할당할거면 파이썬 내부에서는 하나의 오브젝트로 생성.
# Why? 효율성과 생산성 속도 때문에!
m = 800
n = 800
print(id(m))
print(id(n))
print(id(m)==id(n))
print()
# 다양한 변수 선언
# Camel Case : numberOfCollegeGraduates -> Method선언할때
# Pascal Case : NumberOfCollegeGraduates -> Class선언할때
# Snake Case : number_of_college_graduates -> 파이썬에서 변수로 선언할때 많이 사용 (전부 소문자)
# 허용하는 변수 선언 법
# 소문자나 Snake Case형태로 변수 선언하는 것이 매우 깔끔한 코드를 만들 수 있다는 것
age = 1
Age = 2
aGe = 3
AGE = 4
a_g_e = 5
_age = 6
age_ = 7
_AGE_ = 8
# 예약어는 변수명으로 불가능
"""
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
"""
You can’t perform that action at this time.