Created
November 22, 2018 08:12
-
-
Save zhuifengshen/9d3e1e095084e6b98d08eb848bcecc75 to your computer and use it in GitHub Desktop.
列表递归获取个数
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def count(lst): | |
if lst == []: | |
retrun 0 | |
else: | |
return 1 + count(lst[1:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment