From 35cd0ec65acdd3a2c925c3a5d3a193bd307cdc5a Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Mon, 1 Jan 2024 14:44:14 +0000 Subject: - Added solutions by David Ferrone. - Added solutions by PokGoPun. - Added solutions by Stephen G Lynn. - Added solutions by Mark Anderson. - Added solutions by Thomas Kohler. - Added solutions by Peter Meszaros. - Added solutions by Bob Lied. --- challenge-250/eric-cheung/python/ch-2.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 challenge-250/eric-cheung/python/ch-2.py (limited to 'challenge-250/eric-cheung/python/ch-2.py') diff --git a/challenge-250/eric-cheung/python/ch-2.py b/challenge-250/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..43a7617ff9 --- /dev/null +++ b/challenge-250/eric-cheung/python/ch-2.py @@ -0,0 +1,9 @@ + +def GetAlphaNumLen (strInput): + return int(strInput) if strInput.isnumeric() else len(strInput) + +## arrAlphaNumStr = ["perl", "2", "000", "python", "r4ku"] ## Example 1 +arrAlphaNumStr = ["001", "1", "000", "0001"] ## Example 2 + +arrOutput = [GetAlphaNumLen(strLoop) for strLoop in arrAlphaNumStr] +print (max(arrOutput)) -- cgit