Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Python-100-Days
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huangkq
Python-100-Days
Commits
601efd95
Commit
601efd95
authored
Aug 01, 2018
by
jackfrued
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加了示例代码
parent
c2c2786a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
0 deletions
+51
-0
homework01.py
Day31-35/code/homework01.py
+51
-0
Django-Flowchart.png
Day41-55/res/Django-Flowchart.png
+0
-0
Django-MTV.png
Day41-55/res/Django-MTV.png
+0
-0
No files found.
Day31-35/code/homework01.py
0 → 100644
View file @
601efd95
# 经典递归求解问题:
# 1. 迷宫寻路
# 2. 汉诺塔(梵塔)
# 3. 骑士周游
# 4. 八皇后
def
f
(
n
:
int
,
m
=
1
)
->
int
:
if
n
==
0
or
n
==
1
:
return
m
return
f
(
n
-
1
,
n
*
m
)
def
sum
(
n
:
int
)
->
int
:
if
n
==
1
:
return
1
return
n
+
sum
(
n
-
1
)
def
steps
(
n
:
int
,
m
=
{})
->
int
:
if
n
<
0
:
return
0
elif
n
==
0
:
return
1
else
:
try
:
return
m
[
n
]
except
:
m
[
n
]
=
steps
(
n
-
1
)
+
steps
(
n
-
2
)
+
steps
(
n
-
3
)
return
m
[
n
]
def
list_depth
(
items
:
list
)
->
int
:
max_depth
=
1
if
isinstance
(
items
,
list
)
else
0
if
max_depth
:
for
item
in
items
:
if
isinstance
(
item
,
list
):
max_depth
=
max
(
max_depth
,
list_depth
(
item
)
+
1
)
return
max_depth
def
main
():
mylist
=
[
1
,
[
'a'
,
[
'b'
,
[
'c'
]]],[
100
,
[
200
,
300
,
[
400
,
[
500
,
[
600
,
[
700
]]]]]]]
thylist
=
[[],
[[[]]],
[[],
[]]]
print
(
list_depth
(
mylist
))
print
(
list_depth
(
thylist
))
if
__name__
==
'__main__'
:
main
()
Day41-55/res/Django-Flowchart.png
0 → 100644
View file @
601efd95
540 KB
Day41-55/res/Django-MTV.png
0 → 100644
View file @
601efd95
142 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment