From 073d2027ee5b7722dd465a7b82d1cac94635334d Mon Sep 17 00:00:00 2001 From: pybites Date: Sun, 15 Jan 2017 22:01:52 +0100 Subject: [PATCH] use the more pythonic key=func syntax for max function --- 02/game-help.py | 2 +- 02/game-nohelp.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/02/game-help.py b/02/game-help.py index a253aeaa1..a2963b839 100644 --- a/02/game-help.py +++ b/02/game-help.py @@ -46,7 +46,7 @@ def _get_permutations_draw(draw): # From challenge 01: def max_word_value(words): """Calc the max value of a collection of words""" - return max(words, key=lambda w: calc_word_value(w)) + return max(words, key=calc_word_value) def main(): diff --git a/02/game-nohelp.py b/02/game-nohelp.py index 4b15f50fd..1531d09e5 100644 --- a/02/game-nohelp.py +++ b/02/game-nohelp.py @@ -16,11 +16,12 @@ def calc_word_value(word): # re-use from challenge 01 def max_word_value(words): """Calc the max value of a collection of words""" - return max(words, key=lambda w: calc_word_value(w)) + return max(words, key=calc_word_value) def main(): pass + if __name__ == "__main__": main()