From 60418a6fd7a2f35aef237279bc721e6470af936f Mon Sep 17 00:00:00 2001 From: Sanders Lin <45224617+SandersLin@users.noreply.github.com> Date: Wed, 13 Feb 2019 14:55:48 +0800 Subject: [PATCH] Create project Euler problem 8 sol2.py (#644) intuitive solution using functional programming --- project_euler/problem_08/sol2.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 project_euler/problem_08/sol2.py diff --git a/project_euler/problem_08/sol2.py b/project_euler/problem_08/sol2.py new file mode 100644 index 000000000..ae03f3ad0 --- /dev/null +++ b/project_euler/problem_08/sol2.py @@ -0,0 +1,8 @@ +from functools import reduce + +def main(): + number=input().strip() + print(max([reduce(lambda x,y: int(x)*int(y),number[i:i+13]) for i in range(len(number)-12)])) + +if __name__ == '__main__': + main()