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
rejenver
python_study
Commits
cd864de6
Commit
cd864de6
authored
6 years ago
by
rejenver
Browse files
Options
Downloads
Patches
Plain Diff
Add new file
parent
e11af671
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
창의소프트웨어입문 11/16
+110
-0
110 additions, 0 deletions
창의소프트웨어입문 11/16
with
110 additions
and
0 deletions
창의소프트웨어입문 11/16
0 → 100644
+
110
−
0
View file @
cd864de6
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.
>>> a = ["aaa", "bbb", "ccc"]
>>> a
['aaa', 'bbb', 'ccc']
>>> a[1]
'bbb'
>>> b = [123,456,"789"]
>>> type b[1]
SyntaxError: invalid syntax
>>> type b
SyntaxError: invalid syntax
>>> type(b[1])
<class 'int'>
>>> type(b[2])
<class 'str'>
>>> b[0:1]
[123]
>>> b[0:2]
[123, 456]
>>> b[0:3]
[123, 456, '789']
>>> b[1:2]
[456]
>>> len(a)
3
>>> len(b)
3
>>> s="Dohun Na"
>>> s[2] = D
Traceback (most recent call last):
File "<pyshell#15>", line 1, in <module>
s[2] = D
NameError: name 'D' is not defined
>>> s[2] = "D"
Traceback (most recent call last):
File "<pyshell#16>", line 1, in <module>
s[2] = "D"
TypeError: 'str' object does not support item assignment
>>> s = "Kim"
>>> t = (1,2,3)
>>> t = (3,4,5)
>>> t
(3, 4, 5)
>>> c = (1,)
>>> type(c)
<class 'tuple'>
>>> c = 1,
>>> type(c)
<class 'tuple'>
>>> c
(1,)
>>> d = (1)
>>> type(d)
<class 'int'>
>>> d = 1 + 3 & 0x01
>>> type(d)
<class 'int'>
>>> d
0
>>> a = -1
>>> bin(a)
'-0b1'
>>> a = -4
>>> bin(a)
'-0b100'
>>> b = 0b00110011
>>> a & b
48
>>> bin(a & b)
'0b110000'
>>> b
51
>>> (a * -1) = (a + 1)
SyntaxError: can't assign to operator
>>> (a * -1) = (a + -1)
SyntaxError: can't assign to operator
>>> a = 1,2,3
>>> a
(1, 2, 3)
>>> one, two, three = a
>>> one
1
>>> tow
Traceback (most recent call last):
File "<pyshell#45>", line 1, in <module>
tow
NameError: name 'tow' is not defined
>>> two
2
>>> three
3
>>> a
(1, 2, 3)
>>> 1
1
>>> a="1234"
>>> len(a)
4
>>> a
'1234'
>>> len = "1234"
>>> len(len)
Traceback (most recent call last):
File "<pyshell#54>", line 1, in <module>
len(len)
TypeError: 'str' object is not callable
>>>
\ No newline at end of file
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