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
171e1519
Commit
171e1519
authored
6 years ago
by
rejenver
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
03287606
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/12.04#1.py
+163
-0
163 additions, 0 deletions
창의소프트웨어입문 11/12.04#1.py
with
163 additions
and
0 deletions
창의소프트웨어입문 11/12.04#1.py
0 → 100644
+
163
−
0
View file @
171e1519
Python
3.7
.
0
(
v3
.
7.0
:
1
bf9cc5093
,
Jun
27
2018
,
04
:
59
:
51
)
[
MSC
v
.
1914
64
bit
(
AMD64
)]
on
win32
Type
"
copyright
"
,
"
credits
"
or
"
license()
"
for
more
information
.
>>>
a
=
100
>>>
def
local_test
()
SyntaxError
:
invalid
syntax
>>>
def
local_test
SyntaxError
:
invalid
syntax
>>>
def
local_test
():
a
=
1
print
(
a
)
>>>
a
100
>>>
local_test
()
1
>>>
a
100
>>>
def
local_test
():
global
a
=
1
SyntaxError
:
invalid
syntax
>>>
def
local_test
():
global
a
a
=
1
print
(
a
)
>>>
a
100
>>>
local_test
()
1
>>>
a
1
>>>
def
fac
(
n
):
if
n
==
0
:
return
1
if
n
>
0
;
SyntaxError
:
invalid
syntax
>>>
def
fac
(
n
):
if
n
==
0
:
return
1
if
n
>
0
:
return
fac
(
n
-
1
)
*
n
>>>
fac
(
5
)
120
>>>
fac
(
100
)
93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
>>>
fac
(
5000
)
Traceback
(
most
recent
call
last
):
File
"
<pyshell#32>
"
,
line
1
,
in
<
module
>
fac
(
5000
)
File
"
<pyshell#29>
"
,
line
5
,
in
fac
return
fac
(
n
-
1
)
*
n
File
"
<pyshell#29>
"
,
line
5
,
in
fac
return
fac
(
n
-
1
)
*
n
File
"
<pyshell#29>
"
,
line
5
,
in
fac
return
fac
(
n
-
1
)
*
n
[
Previous
line
repeated
989
more
times
]
File
"
<pyshell#29>
"
,
line
2
,
in
fac
if
n
==
0
:
RecursionError
:
maximum
recursion
depth
exceeded
in
comparison
>>>
fac
(
200
)
788657867364790503552363213932185062295135977687173263294742533244359449963403342920304284011984623904177212138919638830257642790242637105061926624952829931113462857270763317237396988943922445621451664240254033291864131227428294853277524242407573903240321257405579568660226031904170324062351700858796178922222789623703897374720000000000000000000000000000000000000000000000000
>>>
def
hello_korean
():
print
(
'
안녕하세요.
'
)
>>>
def
hello_english
():
print
(
'
Hello.
'
)
>>>
def
greet
(
hello
):
hello
()
>>>
greet
(
hello_korean
)
안녕하세요
.
>>>
greet
(
hello_english
)
Hello
.
>>>
def
fac
(
n
=
0
):
s
=
1
if
n
==
0
:
return
1
if
n
>
0
:
s
=
s
*
n
print
(
s
)
return
fac
(
n
-
1
)
*
n
>>>
fac
(
10
)
10
9
8
7
6
5
4
3
2
1
3628800
>>>
import
math
>>>
def
stddev
(
*
args
):
def
mean
():
return
sum
(
args
)
/
len
(
args
)
def
variance
(
m
):
total
=
0
for
arg
in
args
:
total
+=
(
arg
-
m
)
**
2
return
total
/
(
len
(
args
)
-
1
)
v
=
variance
(
mean
())
return
math
.
sqrt
(
v
)
>>>
stddev
(
1
,
2
,
3
)
1.0
>>>
def
mean
():
return
sum
(
args
)
/
len
(
args
)
>>>
def
mean
():
return
sum
(
args
)
/
len
(
args
)
def
variance
(
m
):
total
=
0
for
arg
in
args
:
total
+=
(
arg
-
m
)
**
2
return
total
/
(
len
(
args
)
-
1
)
def
stddev
(
*
args
):
SyntaxError
:
invalid
syntax
>>>
def
mean
(
*
args
):
return
sum
(
args
)
/
len
(
args
)
def
variance
(
*
args
):
total
=
0
m
=
mean
(
args
)
for
arg
in
args
:
total
+=
(
arg
-
m
)
**
2
return
total
/
(
len
(
args
)
-
1
)
SyntaxError
:
invalid
syntax
>>>
def
stddev2
(
*
args
):
def
mean
():
return
sum
(
args
)
/
len
(
args
)
def
variance
(
m
):
total
=
0
for
arg
in
args
:
total
+=
(
arg
-
m
)
**
2
return
total
/
(
len
(
args
)
-
1
)
v
=
variance
(
mean
())
return
math
.
sqrt
(
v
)
>>>
def
mean
(
*
args
):
print
(
args
)
return
sum
(
args
)
/
len
(
args
)
>>>
mean
(
10
,
20
)
(
10
,
20
)
15.0
>>>
stddev
(
1
,
2
,
3
)
1.0
>>>
stddev2
(
1
,
2
,
3
)
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