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
c26684f3
Commit
c26684f3
authored
6 years ago
by
KimMinSeob
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
c6b21428
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
창소입3.txt
+50
-0
50 additions, 0 deletions
창소입3.txt
with
50 additions
and
0 deletions
창소입3.txt
0 → 100644
+
50
−
0
View file @
c26684f3
"1111111".count("1")
"1111111".count("11") 해보기
{
a='1111111'
a.replace("1","2")
}
import math as m 은 math를 m으로 표현할수있도록 만들어준다.
비트다루기 중요.
파이썬에 이진수 넣을때 '0b'사용
>>> bin(0b110110110110111 ^ 0b1111)
'0b110110110111000'
바꾸고자 하는 비트에 1을 넣고 ^ 연산.
0b1111 은 10진수로 15
16진수로 0xf
8진수로 0o17
not 연산자 시 양수에서 음수로 갈때 -1 해준다.
a=255
~a
a=-256
>>> bin(a)
'0b100100100100'
>>> bin(~a)
'-0b100100100101'
>>> bin(-a)
'-0b100100100100'
bin(a & -16)
>> 맨뒤에 4자리를 0으로 만든다.
특정비트를 0으로 바꿀때 그 비트자리 & 0
특정비트를 1으로 바꿀때 그 비트자리 | 1
-1과 ^연산하면 0은 1 1은 0으로 바뀜
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