Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
Python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KimMinSeob
Python
Commits
abc6a1e9
Commit
abc6a1e9
authored
6 years ago
by
KimMinSeob
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
4e799c4d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
1127python.py
+253
-0
253 additions, 0 deletions
1127python.py
with
253 additions
and
0 deletions
1127python.py
0 → 100644
+
253
−
0
View file @
abc6a1e9
Python
3.7
.
0
(
v3
.
7.0
:
1
bf9cc5093
,
Jun
27
2018
,
04
:
59
:
51
)
[
MSC
v
.
1914
64
bit
(
AMD64
)]
on
win32
Type
"
copyright
"
,
"
credits
"
or
"
license()
"
for
more
information
.
>>>
5
in
range
(
10
)
True
>>>
range
(
10
)
range
(
0
,
10
)
>>>
5
in
range
(
10
)
True
>>>
10
in
range
(
10
)
False
>>>
a
,
b
,
c
=
(
1
,
2
,
3
)
>>>
a
1
>>>
b
2
>>>
c
3
>>>
>>>
dic
=
{
'
애플
'
:
'
www.apple.com
'
,
'
파이썬
'
:
'
www.python.org
'
,
'
마이크로소프트
'
:
'
www.microsoft.com
'
}
SyntaxError
:
invalid
syntax
>>>
>>>
dic
=
{
'
애플
'
:
'
www.apple.com
'
,
'
파이썬
'
:
'
www.python.org
'
,
'
마이크로소프트
'
:
'
www.microsoft.com
'
}
SyntaxError
:
invalid
syntax
>>>
>>>
dic
=
{
'
애플
'
:
'
www.apple.com
'
,
'
파이썬
'
:
'
www.python.org
'
,
'
마이크로소프트
'
:
'
www.microsoft.com
'
}
SyntaxError
:
unexpected
indent
>>>
dic
=
{
'
애플
'
:
'
www.apple.com
'
,
'
파이썬
'
:
'
www.python.org
'
,
'
마이크로소프트
'
:
'
www.microsoft.com
'
}
>>>
for
k
,
v
in
dic
.
items
():
print
(
k
,
v
)
애플
www
.
apple
.
com
파이썬
www
.
python
.
org
마이크로소프트
www
.
microsoft
.
com
>>>
for
i
in
dic
:
print
(
i
)
애플
파이썬
마이크로소프트
>>>
for
i
in
die
:
print
(
i
,
dic
[
i
])
Traceback
(
most
recent
call
last
):
File
"
<pyshell#22>
"
,
line
1
,
in
<
module
>
for
i
in
die
:
NameError
:
name
'
die
'
is
not
defined
>>>
for
i
in
dic
:
print
(
i
,
dic
[
i
])
애플
www
.
apple
.
com
파이썬
www
.
python
.
org
마이크로소프트
www
.
microsoft
.
com
>>>
for
i
in
dic
:
if
(
i
==
'
애플
'
):
print
(
i
,
dic
[
i
])
애플
www
.
apple
.
com
>>>
for
i
in
dic
:
if
(
i
==
'
애플
'
):
print
(
i
,
dic
[
i
])
break
애플
www
.
apple
.
com
>>>
for
i
in
dic
:
if
(
i
==
'
마이크로소프트
'
):
print
(
i
,
dic
[
i
])
break
>>>
#break 의 위치에 대한 것 . if 안에 있냐 아니냐
>>>
for
i
in
range
(
10
):
if
i
%
2
==
1
:
continue
print
(
i
)
0
2
4
6
8
>>>
#continue 하면 다시 루프의 처음으로 돌아간다.
>>>
def
hello
():
print
(
"
Hello , World
"
)
>>>
hello
()
Hello
,
World
>>>
def
abs
(
arg
):
if
(
arg
<
0
):
result
=
arg
*
-
1
else
:
result
=
arg
>>>
value
=
abs
(
10
)
>>>
value
>>>
>>>
>>>
>>>
def
abs
(
arg
):
if
(
arg
<
0
):
result
=
arg
*-
1
else
:
result
=
arg
return
result
>>>
value
=
abs
(
10
)
>>>
value
10
>>>
value
=
abs
(
-
10
)
>>>
value
10
>>>
def
minus
(
x
):
x
=-
x
>>>
a
=
10
>>>
a
10
>>>
a
=
minus
(
a
)
>>>
a
>>>
a
>>>
a
a
>>>
>>>
a
>>>
a
a
>>>
a
>>>
a
>>>
a
>>>
a
>>>
a
>>>
>>>
a
a
>>>
>>>
a
>>>
a
>>>
a
>>>
a
=
10
>>>
a
10
>>>
minus
(
a
)
>>>
a
10
>>>
a
=
[
10
,
20
]
>>>
minus
(
a
)
Traceback
(
most
recent
call
last
):
File
"
<pyshell#99>
"
,
line
1
,
in
<
module
>
minus
(
a
)
File
"
<pyshell#73>
"
,
line
2
,
in
minus
x
=-
x
TypeError
:
bad
operand
type
for
unary
-
:
'
list
'
>>>
minus
([
a
])
Traceback
(
most
recent
call
last
):
File
"
<pyshell#100>
"
,
line
1
,
in
<
module
>
minus
([
a
])
File
"
<pyshell#73>
"
,
line
2
,
in
minus
x
=-
x
TypeError
:
bad
operand
type
for
unary
-
:
'
list
'
>>>
minus
(
a
[
0
])
>>>
a
[
10
,
20
]
>>>
def
minuslist
(
l
):
l
[
0
]
=
20
>>>
minuslist
(
a
)
>>>
a
[
20
,
20
]
>>>
#리스트는 함수를 통해 값을 변경할수있다.
>>>
def
print_personnel
(
name
,
position
=
'
staff
'
,
nationality
=
'
Korea
'
):
print
(
'
name = {0}
'
.
format
(
name
))
print
(
'
position = {0}
'
.
format
(
position
))
print
(
'
nationality = {0}
'
.
format
(
nationality
))
>>>
print_personnel
(
'
kimminseob
'
)
name
=
kimminseob
position
=
staff
nationality
=
Korea
>>>
print_personnel
(
'
kimminseob
'
,
nationality
=
'
usa
'
)
name
=
kimminseob
position
=
staff
nationality
=
usa
>>>
def
print_personnel
(
name
=
'
kimminseob
'
,
position
=
'
staff
'
,
nationality
=
'
Korea
'
):
print
(
'
name = {0}
'
.
format
(
name
))
print
(
'
position = {0}
'
.
format
(
position
))
print
(
'
nationality = {0}
'
.
format
(
nationality
))
>>>
print_personnel
(
position
=
'
ceo
'
)
name
=
kimminseob
position
=
ceo
nationality
=
Korea
>>>
print_personnel
()
name
=
kimminseob
position
=
staff
nationality
=
Korea
>>>
def
fl
(
*
a
)
SyntaxError
:
invalid
syntax
>>>
def
fl
(
*
a
):
for
x
in
a
:
print
(
type
(
x
),
x
)
>>>
fl
(
123
,(
3
,
4
,
5
),
"
김민섭
"
,{
a
=
12345
})
SyntaxError
:
invalid
syntax
>>>
fl
(
123
,(
3
,
4
,
5
),
"
김민섭
"
,{
a
==
12345
})
<
class
'
int
'
> 123
<class
'
tuple
'
> (3, 4, 5)
<class
'
str
'
> 김민섭
<class
'
set
'
> {False}
>>>
def
print_team
(
**
players
):
for
k
in
players
.
keys
():
print
(
'
{0} = {1}
'
.
format
(
k
,
players
[
k
]))
>>>
print_team
(
카시야스
=
'
GK
'
,
호날두
=
'
FW
'
,
알론소
=
'
MF
'
,
페페
=
'
DF
'
)
카시야스 = GK
호날두 = FW
알론소 = MF
페페 = DF
>>>
a
=
10
>>>
a
=
10.0
>>>
a
10.0
>>>
a
=
"
aaaaa
"
>>>
ㅁ
Traceback
(
most
recent
call
last
):
File
"
<pyshell#129>
"
,
line
1
,
in
<
module
>
ㅁ
NameError
:
name
'
ᄆ
'
is
not
defined
>>>
a
'
aaaaa
'
>>>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment