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
dfe36204
Commit
dfe36204
authored
6 years ago
by
Minseong Kwon
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
ca172f27
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_20 수업내용.py
+383
-0
383 additions, 0 deletions
11_20 수업내용.py
with
383 additions
and
0 deletions
11_20 수업내용.py
0 → 100644
+
383
−
0
View file @
dfe36204
Python
3.7
.
1
(
v3
.
7.1
:
260
ec2c36a
,
Oct
20
2018
,
14
:
05
:
16
)
[
MSC
v
.
1915
32
bit
(
Intel
)]
on
win32
Type
"
help
"
,
"
copyright
"
,
"
credits
"
or
"
license()
"
for
more
information
.
>>>
a
=
[(
2
,
3
,
4
),(
4
,
5
,
6
)]
>>>
a
[
0
][
0
]
2
>>>
a
[
0
][
0
]
=
3
Traceback
(
most
recent
call
last
):
File
"
<pyshell#2>
"
,
line
1
,
in
<
module
>
a
[
0
][
0
]
=
3
TypeError
:
'
tuple
'
object
does
not
support
item
assignment
>>>
b
=
([
1
,
2
,
3
]),[
3
,
4
,
5
])
SyntaxError
:
invalid
syntax
>>>
b
=
([
1
,
2
,
3
]),[
3
,
4
,
5
])
SyntaxError
:
unexpected
indent
>>>
b
([
1
,
2
,
3
],[
4
,
5
,
6
])
Traceback
(
most
recent
call
last
):
File
"
<pyshell#5>
"
,
line
1
,
in
<
module
>
b
([
1
,
2
,
3
],[
4
,
5
,
6
])
NameError
:
name
'
b
'
is
not
defined
>>>
b
=
([
1
,
2
,
3
],[
4
,
5
,
6
])
>>>
b
[
0
][
0
]
1
>>>
b
[
0
][
0
]
=
3
>>>
b
([
3
,
2
,
3
],
[
4
,
5
,
6
])
>>>
a
=
12345
>>>
a
&
1
1
>>>
a
=
123456
>>>
a
&
1
0
>>>
a
&
2
0
>>>
a
&
3
0
>>>
a
&
0b11
0
>>>
a
&
0b11111111
64
>>>
a
&
255
64
>>>
bin
(
123456
)
'
0b11110001001000000
'
>>>
b
=
a
&
65535
>>>
a
&
0xffffffff
123456
>>>
b
57920
>>>
b
=
a
&
0xffffffff
>>>
>>>
b
123456
>>>
a
=
23232323
>>>
b
=
a
&
0xffffffff
>>>
count
=
0
>>>
for
x
in
range
(
32
);
SyntaxError
:
invalid
syntax
>>>
for
x
in
range
(
32
):
if
(
a
&
(
1
<<
x
)
!=
0
):
count
=
count
+
1
print
(
a
,
bin
(
a
),
count
)
23232323
0b1011000100111111101000011
1
23232323
0b1011000100111111101000011
2
23232323
0b1011000100111111101000011
3
23232323
0b1011000100111111101000011
4
23232323
0b1011000100111111101000011
5
23232323
0b1011000100111111101000011
6
23232323
0b1011000100111111101000011
7
23232323
0b1011000100111111101000011
8
23232323
0b1011000100111111101000011
9
23232323
0b1011000100111111101000011
10
23232323
0b1011000100111111101000011
11
23232323
0b1011000100111111101000011
12
23232323
0b1011000100111111101000011
13
23232323
0b1011000100111111101000011
14
>>>
for
x
in
range
(
32
):
if
(
a
&
(
1
<<
x
)
!=
0
):
count
=
count
+
1
print
(
a
,
bin
(
a
),
32
-
count
)
23232323
0b1011000100111111101000011
17
23232323
0b1011000100111111101000011
16
23232323
0b1011000100111111101000011
15
23232323
0b1011000100111111101000011
14
23232323
0b1011000100111111101000011
13
23232323
0b1011000100111111101000011
12
23232323
0b1011000100111111101000011
11
23232323
0b1011000100111111101000011
10
23232323
0b1011000100111111101000011
9
23232323
0b1011000100111111101000011
8
23232323
0b1011000100111111101000011
7
23232323
0b1011000100111111101000011
6
23232323
0b1011000100111111101000011
5
23232323
0b1011000100111111101000011
4
>>>
for
x
in
range
(
32
):
if
(
a
&
(
1
<<
x
)
==
0
):
count
=
count
+
1
print
(
a
,
bin
(
a
),
count
)
23232323
0b1011000100111111101000011
29
23232323
0b1011000100111111101000011
30
23232323
0b1011000100111111101000011
31
23232323
0b1011000100111111101000011
32
23232323
0b1011000100111111101000011
33
23232323
0b1011000100111111101000011
34
23232323
0b1011000100111111101000011
35
23232323
0b1011000100111111101000011
36
23232323
0b1011000100111111101000011
37
23232323
0b1011000100111111101000011
38
23232323
0b1011000100111111101000011
39
23232323
0b1011000100111111101000011
40
23232323
0b1011000100111111101000011
41
23232323
0b1011000100111111101000011
42
23232323
0b1011000100111111101000011
43
23232323
0b1011000100111111101000011
44
23232323
0b1011000100111111101000011
45
23232323
0b1011000100111111101000011
46
>>>
a
=
23232323
>>>
b
=
a
&
0xffffffff
>>>
b
23232323
>>>
count
=
0
>>>
for
x
in
range
(
32
):
if
(
a
&
(
1
<<
x
)
!=
0
):
count
=
count
+
1
print
(
a
,
bin
(
a
),
32
-
count
)
23232323
0b1011000100111111101000011
31
23232323
0b1011000100111111101000011
30
23232323
0b1011000100111111101000011
29
23232323
0b1011000100111111101000011
28
23232323
0b1011000100111111101000011
27
23232323
0b1011000100111111101000011
26
23232323
0b1011000100111111101000011
25
23232323
0b1011000100111111101000011
24
23232323
0b1011000100111111101000011
23
23232323
0b1011000100111111101000011
22
23232323
0b1011000100111111101000011
21
23232323
0b1011000100111111101000011
20
23232323
0b1011000100111111101000011
19
23232323
0b1011000100111111101000011
18
>>>
for
x
in
range
(
32
):
if
(
a
&
(
1
<<
x
)
!=
0
):
count
=
count
+
1
print
(
a
,
bin
(
a
),
count
)
23232323
0b1011000100111111101000011
15
23232323
0b1011000100111111101000011
16
23232323
0b1011000100111111101000011
17
23232323
0b1011000100111111101000011
18
23232323
0b1011000100111111101000011
19
23232323
0b1011000100111111101000011
20
23232323
0b1011000100111111101000011
21
23232323
0b1011000100111111101000011
22
23232323
0b1011000100111111101000011
23
23232323
0b1011000100111111101000011
24
23232323
0b1011000100111111101000011
25
23232323
0b1011000100111111101000011
26
23232323
0b1011000100111111101000011
27
23232323
0b1011000100111111101000011
28
>>>
>>>
for
x
in
range
(
32
):
if
(
a
&
(
1
<<
x
)
!=
0
):
count
=
count
+
1
print
(
a
,
bin
(
a
),
count
)
23232323
0b1011000100111111101000011
29
23232323
0b1011000100111111101000011
30
23232323
0b1011000100111111101000011
31
23232323
0b1011000100111111101000011
32
23232323
0b1011000100111111101000011
33
23232323
0b1011000100111111101000011
34
23232323
0b1011000100111111101000011
35
23232323
0b1011000100111111101000011
36
23232323
0b1011000100111111101000011
37
23232323
0b1011000100111111101000011
38
23232323
0b1011000100111111101000011
39
23232323
0b1011000100111111101000011
40
23232323
0b1011000100111111101000011
41
23232323
0b1011000100111111101000011
42
>>>
for
x
in
range
(
32
):
if
(
a
&
(
1
<<
x
)
!=
0
):
count
=
count
+
1
print
(
a
,
bin
(
a
),
count
)
23232323
0b1011000100111111101000011
43
23232323
0b1011000100111111101000011
44
23232323
0b1011000100111111101000011
45
23232323
0b1011000100111111101000011
46
23232323
0b1011000100111111101000011
47
23232323
0b1011000100111111101000011
48
23232323
0b1011000100111111101000011
49
23232323
0b1011000100111111101000011
50
23232323
0b1011000100111111101000011
51
23232323
0b1011000100111111101000011
52
23232323
0b1011000100111111101000011
53
23232323
0b1011000100111111101000011
54
23232323
0b1011000100111111101000011
55
23232323
0b1011000100111111101000011
56
>>>
for
x
in
range
(
32
):
if
(
a
&
(
1
<<
x
)
!=
0
):
count
=
count
+
1
print
(
a
,
bin
(
a
),
count
)
23232323
0b1011000100111111101000011
57
23232323
0b1011000100111111101000011
58
23232323
0b1011000100111111101000011
59
23232323
0b1011000100111111101000011
60
23232323
0b1011000100111111101000011
61
23232323
0b1011000100111111101000011
62
23232323
0b1011000100111111101000011
63
23232323
0b1011000100111111101000011
64
23232323
0b1011000100111111101000011
65
23232323
0b1011000100111111101000011
66
23232323
0b1011000100111111101000011
67
23232323
0b1011000100111111101000011
68
23232323
0b1011000100111111101000011
69
23232323
0b1011000100111111101000011
70
>>>
count
=
0
>>>
for
x
in
range
(
32
):
if
(
a
&
(
1
<<
x
)
!=
0
):
count
=
count
+
1
print
(
a
,
bin
(
a
),
count
)
23232323
0b1011000100111111101000011
1
23232323
0b1011000100111111101000011
2
23232323
0b1011000100111111101000011
3
23232323
0b1011000100111111101000011
4
23232323
0b1011000100111111101000011
5
23232323
0b1011000100111111101000011
6
23232323
0b1011000100111111101000011
7
23232323
0b1011000100111111101000011
8
23232323
0b1011000100111111101000011
9
23232323
0b1011000100111111101000011
10
23232323
0b1011000100111111101000011
11
23232323
0b1011000100111111101000011
12
23232323
0b1011000100111111101000011
13
23232323
0b1011000100111111101000011
14
>>>
count
=
0
>>>
for
x
in
range
(
32
):
if
(
a
&
(
1
<<
x
)
==
0
):
count
=
count
+
1
print
(
a
,
bin
(
a
),
count
)
23232323
0b1011000100111111101000011
1
23232323
0b1011000100111111101000011
2
23232323
0b1011000100111111101000011
3
23232323
0b1011000100111111101000011
4
23232323
0b1011000100111111101000011
5
23232323
0b1011000100111111101000011
6
23232323
0b1011000100111111101000011
7
23232323
0b1011000100111111101000011
8
23232323
0b1011000100111111101000011
9
23232323
0b1011000100111111101000011
10
23232323
0b1011000100111111101000011
11
23232323
0b1011000100111111101000011
12
23232323
0b1011000100111111101000011
13
23232323
0b1011000100111111101000011
14
23232323
0b1011000100111111101000011
15
23232323
0b1011000100111111101000011
16
23232323
0b1011000100111111101000011
17
23232323
0b1011000100111111101000011
18
>>>
a
=
3
>
2
SyntaxError
:
unexpected
indent
>>>
a
=
3
>
2
>>>
>>>
a
True
>>>
a
=
3
>>
2
>>>
a
0
>>>
not
True
False
>>>
not
False
True
>>>
not
1
False
>>>
not
-
1
False
>>>
not
0
True
>>>
a
=
"
0
"
>>>
not
a
False
>>>
a
=
"
apple
"
>>>
not
a
False
>>>
a
=
0
>>>
not
a
True
>>>
a
=
""
>>>
not
a
True
>>>
a
=
[]
>>>
not
a
True
>>>
a
=
(
1
,
2
)
>>>
not
a
False
>>>
a
=
()
>>>
not
a
True
>>>
not
0.0
True
>>>
print
(
'
수를 입력하세요
'
)
수를
입력하세요
>>>
a
=
input
()
a
=
input
()
>>>
2
2
>>>
================
RESTART
:
C
:
/
Users
/
권민성
/
Desktop
/
python
/
조건문
.
py
================
수를
입력하세요
2
3
/
2
=
1.5
>>>
================
RESTART
:
C
:
/
Users
/
권민성
/
Desktop
/
python
/
조건문
.
py
================
수를
입력하세요
0
0
은
나눗셈에
이용할
수
없습니다
.
>>>
================
RESTART
:
C
:
/
Users
/
권민성
/
Desktop
/
python
/
조건문
.
py
================
수를
입력하세요
stunr
숫자를
입력하세요
>>>
10
10
>>>
2
2
>>>
================
RESTART
:
C
:
/
Users
/
권민성
/
Desktop
/
python
/
조건문
.
py
================
수를
입력하세요
2
3
/
2
=
1.5
>>>
10
10
>>>
================
RESTART
:
C
:
/
Users
/
권민성
/
Desktop
/
python
/
조건문
.
py
================
수를
입력하세요
10
3
/
10
=
0.3
>>>
10
10
>>>
10
10
>>>
================
RESTART
:
C
:
/
Users
/
권민성
/
Desktop
/
python
/
조건문
.
py
================
수를
입력하세요
================
RESTART
:
C
:
/
Users
/
권민성
/
Desktop
/
python
/
조건문
.
py
================
수를
입력하세요
hello
숫자를
입력하세요
>>>
2
2
>>>
================
RESTART
:
C
:
/
Users
/
권민성
/
Desktop
/
python
/
조건문
.
py
================
수를
입력하세요
================
RESTART
:
C
:
/
Users
/
권민성
/
Desktop
/
python
/
조건문
.
py
================
수를
입력하세요
heelo
숫자를
입력하세요
Traceback
(
most
recent
call
last
):
File
"
C:/Users/권민성/Desktop/python/조건문.py
"
,
line
25
,
in
<
module
>
h
NameError
:
name
'
h
'
is
not
defined
>>>
5
5
>>>
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