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
a624ae81
Commit
a624ae81
authored
6 years ago
by
KimMinSeob
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
4133e6b7
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
튜플 연습.py
+90
-0
90 additions, 0 deletions
튜플 연습.py
with
90 additions
and
0 deletions
튜플 연습.py
0 → 100644
+
90
−
0
View file @
a624ae81
Python
3.7
.
1
(
v3
.
7.1
:
260
ec2c36a
,
Oct
20
2018
,
03
:
13
:
28
)
[
Clang
6.0
(
clang
-
600.0
.
57
)]
on
darwin
Type
"
help
"
,
"
copyright
"
,
"
credits
"
or
"
license()
"
for
more
information
.
>>>
#튜플 자료형
>>>
t1
=
()
>>>
t2
=
(
1
,)
>>>
t3
=
(
1
,
2
,
3
)
>>>
t4
=
1
,
2
,
3
>>>
t5
=
(
'
a
'
,
'
b
'
,(
'
c
'
,
'
d
'
))
>>>
type
(
t1
)
<
class
'
tuple
'
>
>>>
type
(
t2
)
<
class
'
tuple
'
>
>>>
type
(
t3
)
Traceback
(
most
recent
call
last
):
File
"
<pyshell#8>
"
,
line
1
,
in
<
module
>
ype
(
t3
)
NameError
:
name
'
ype
'
is
not
defined
ty
>>>
type
(
t3
)
<
class
'
tuple
'
>
>>>
type
(
t4
)
<
class
'
tuple
'
>
>>>
type
(
t5
)
<
class
'
tuple
'
>
>>>
t
=
(
1
)
>>>
type
(
t
)
<
class
'
int
'
>
>>>
#튜플의 요소가 1개일떄는 반드시 ,를 붙여줘야한다.
>>>
#튜플과 리스트의 차이는 요소를 변경시킬수 있느냐 없느냐의 차이이다.
>>>
#튜플은 값을 변경할 수 가없다.
>>>
>>>
t1
=
(
1
,
2
,
'
a
'
,
'
b
'
)
>>>
del
t1
[
0
]
Traceback
(
most
recent
call
last
):
File
"
<pyshell#19>
"
,
line
1
,
in
<
module
>
del
t1
[
0
]
TypeError
:
'
tuple
'
object
doesn
'
t support item deletion
>>>
#튜플은 요소를 지울수도없다.
>>>
t1
[
0
]
1
>>>
t1
[
0
]
=
2
Traceback
(
most
recent
call
last
):
File
"
<pyshell#22>
"
,
line
1
,
in
<
module
>
t1
[
0
]
=
2
TypeError
:
'
tuple
'
object
does
not
support
item
assignment
>>>
#인덱싱
>>>
t1
=
(
1
,
2
,
'
a
'
,
'
b
'
)
>>>
t1
[
2
]
'
a
'
>>>
t1
[
3
]
'
b
'
>>>
#슬라이싱
>>>
t1
[
1
:]
(
2
,
'
a
'
,
'
b
'
)
>>>
t1
[:
2
]
(
1
,
2
)
>>>
#튜플 더하기
>>>
t2
=
(
3
,
4
)
>>>
t1
+
t2
(
1
,
2
,
'
a
'
,
'
b
'
,
3
,
4
)
>>>
t1
*
3
(
1
,
2
,
'
a
'
,
'
b
'
,
1
,
2
,
'
a
'
,
'
b
'
,
1
,
2
,
'
a
'
,
'
b
'
)
>>>
#튜플 연습문제
>>>
# 숫자 3만을 요소로 가지는 튜플을 작성하여라.
>>>
t
=
(
3
)
>>>
type
(
t
)
<
class
'
int
'
>
>>>
t1
=
(
3
,)
>>>
type
(
t1
)
<
class
'
tuple
'
>
>>>
#튜플에 요솣추가.
>>>
t1
=
(
1
,
2
,
3
)
>>>
t1
.
append
(
4
)
Traceback
(
most
recent
call
last
):
File
"
<pyshell#42>
"
,
line
1
,
in
<
module
>
t1
.
append
(
4
)
AttributeError
:
'
tuple
'
object
has
no
attribute
'
append
'
>>>
t1
=
[
1
,
2
,
3
]
>>>
type
(
t1
)
<
class
'
list
'
>
>>>
t1
.
append
(
4
)
>>>
t1
[
1
,
2
,
3
,
4
]
>>>
t2
=
(
1
,
2
,
3
)
>>>
t3
=
(
4
,)
>>>
t4
=
t2
+
t3
>>>
t4
(
1
,
2
,
3
,
4
)
>>>
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