Skip to content

Instantly share code, notes, and snippets.

@m80126colin
Last active March 5, 2020 15:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m80126colin/d0eac9140bfe607b9c1dd8a418d47ba4 to your computer and use it in GitHub Desktop.
Save m80126colin/d0eac9140bfe607b9c1dd8a418d47ba4 to your computer and use it in GitHub Desktop.
from itertools import product
from functools import reduce
class Number():
def __init__(self):
self.num = 0
def succ(self):
self.num += 1
return self
def toInt(self):
return self.num
res = reduce(lambda x, _: x.succ(), product(range(6 + 1), range(4 + 1), range(10)), Number())
print(res.toInt())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment