Skip to content

Instantly share code, notes, and snippets.

@shizone
Last active August 29, 2015 13:56
Show Gist options
  • Save shizone/8993820 to your computer and use it in GitHub Desktop.
Save shizone/8993820 to your computer and use it in GitHub Desktop.
Check iOのRegistrationで怒られた
#python3.3 is inside
def checkio(els):
return reduce(lambda x,y: x+y, els[0:3])
if checkio([1, 2, 3, 4, 5, 6]) == 6:
print('Done!')
#python3.3 is inside
def checkio(els):
from functools import reduce
return reduce(lambda x,y: x+y, els[0:3])
if checkio([1, 2, 3, 4, 5, 6]) == 6:
print('Done!')
#python3.3 is inside
def checkio(els):
return sum(els[0:3])
if checkio([1, 2, 3, 4, 5, 6]) == 6:
print('Done!')
@shizone
Copy link
Author

shizone commented Feb 14, 2014

python3.3 is inside

def checkio(els):
... return reduce(lambda x,y: x+y, els[0:3])
...
if checkio([1, 2, 3, 4, 5, 6]) == 6:
... print('Done!')
...
Done!

@shizone
Copy link
Author

shizone commented Feb 14, 2014

単純に3系でreduceがfunctoolsに移ったかららしい

@shizone
Copy link
Author

shizone commented Feb 14, 2014

あべさんにsumでいいんじゃね?と言われたので

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment