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
Developer articles
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 }}
khl2bb
opensource-class
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
opensource-class
/
python_basic
/
basic_grammer.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
28 lines (21 loc) · 1.01 KB
master
Breadcrumbs
opensource-class
/
python_basic
/
basic_grammer.py
Copy path
Top
File metadata and controls
Code
Blame
28 lines (21 loc) · 1.01 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
# -*- coding: utf-8 -*-
#1. Python 은 변수의 타입이 없다
hong
=
111
# 2. 문자변수의 입력은 쌍따옴표 또는 외따옴표를 앞뒤로 사용한다
words
=
"I am Python"
# 3. 동일한 변수명에 다른타입의 값을 입력할 수 있다.
words
=
157
# 문자열 "I am Python" 를 입력했다가 다시 같은 변수에 숫자 157 입력
# 4. 문장의 끝은 줄바꿈으로 처리한다.
var_a
=
145
var_b
=
"Hello"
var_c
=
"123"
# 5. 기본형에 대한 자동 형변환은 지원하지 않는다
result_char
=
str
(
var_a
)
+
var_b
# 숫자 var_a 를 문자열로 변경한 후 문자열 var_b와 더해준다.
result_num
=
var_a
+
int
(
var_c
)
# 문자열 "123" 을 숫자 123 으로 변경
# 6. 결과값 출력
print
(
result_char
)
# 결과 : 145Hello
print
(
result_num
)
# 결과 : 268
# 7. 문자열 곱하기 (곱한숫자만큼 문자열을 반복해서 더한다음 리턴해준다)
print
(
var_b
*
3
)
# 결과 : HelloHelloHello
# 8. 거듭제곱
print
(
var_a
**
3
)
# 결과 : 3048625 = 145 * 145 * 145
You can’t perform that action at this time.