Created
October 9, 2012 08:36
-
-
Save cuixin/3857389 to your computer and use it in GitHub Desktop.
mypython examples
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 mysum(*args): | |
return sum(args) | |
def mytimes(*args): | |
if not args: | |
return 0 | |
else: | |
result = 1 | |
for v in args: | |
result *= v | |
return result | |
print 'mytimes', apply(mytimes, range(1, 365)) | |
print apply(mysum, range(100)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment