Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
python_study
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
Minseong Kwon
python_study
Commits
ca172f27
Commit
ca172f27
authored
6 years ago
by
Minseong Kwon
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
5ae776fc
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
11-16 수업내용 .txt
+121
-0
121 additions, 0 deletions
11-16 수업내용 .txt
with
121 additions
and
0 deletions
11-16 수업내용 .txt
0 → 100644
+
121
−
0
View file @
ca172f27
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC v.1915 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> #list
>>>
>>>
>>>
>>> a=['김개똥','박짱구','이멍충']
>>> a[0]
'김개똥'
>>> a[1]
'박짱구'
>>> a2[]
SyntaxError: invalid syntax
>>> a[2]
'이멍충'
>>> a=["aaa","bbb","ccc"]
>>> a
['aaa', 'bbb', 'ccc']
>>> a[1,2]
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
a[1,2]
TypeError: list indices must be integers or slices, not tuple
>>> a[2]
'ccc'
>>> a[1]
'bbb'
>>> b[123,456,"789"]
Traceback (most recent call last):
File "<pyshell#14>", line 1, in <module>
b[123,456,"789"]
NameError: name 'b' is not defined
>>> b=[123,456,"79"]
>>> b
[123, 456, '79']
>>> # 슬라이싱
>>>
>>> a=[1,2,3,4,5]
>>> a[1:3}
SyntaxError: invalid syntax
>>> a[1:3]
[2, 3]
>>> len(a)
5
>>> a.pop()
5
>>> a
[1, 2, 3, 4]
>>> a.index(2)
1
>>> a.reverse()
>>> a
[4, 3, 2, 1]
>>> a="apple"
>>> a="bannana"
>>> t=(1,2,3)
>>> t=(2,4,5)
>>> s=kim
Traceback (most recent call last):
File "<pyshell#32>", line 1, in <module>
s=kim
NameError: name 'kim' is not defined
>>> s="kim"
>>> a="kim"
>>> a
'kim'
>>> s
'kim'
>>> type(t)
<class 'tuple'>
>>> a=(1,3)
>>> a
(1, 3)
>>> a=(1)
>>> a
1
>>> a=(1,)
>>> a
(1,)
>>> a=1+3&0x01
>>> a
0
>>> a=-1
>>> bin(a)
'-0b1'
>>> a=-4
>>> bin(a)
'-0b100'
>>> b=0b00110011
>>> a&b
48
>>> bin(a&b)
'0b110000'
>>> a=5
>>> ~a
-6
>>> (a*-1)==(~a+1)
True
>>> a=1,2,3
>>> a*13
(1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3)
>>> 13*a
(1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3)
>>> b="hi"
>>> b*13
'hihihihihihihihihihihihihi'
>>> 13*b
'hihihihihihihihihihihihihi'
>>> len(a)
3
>>> one,two,three=a
>>> one
1
>>> tow
Traceback (most recent call last):
File "<pyshell#65>", line 1, in <module>
tow
NameError: name 'tow' is not defined
>>> two
2
>>>
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