project-euler-100

[RADIOACTIVE] solutions to the first 100 challenges of project euler
git clone git://git.figbert.com/project-euler-100.git
Log | Files | Refs | README

commit b7234294975065e7906701e869e70da13fdedc74
parent 2b02a1a70461c85c6b823c7d88a7044c6b354b9b
Author: therealFIGBERT <figbertwelner@gmail.com>
Date:   Tue, 21 Jan 2020 16:58:05 -0800

Simplify solution to problem 4

Diffstat:
Mproblem004.py | 8+-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/problem004.py b/problem004.py @@ -4,11 +4,5 @@ # language = "Python" # dateCompleted = "21/01/2020" -def palindromeCheck(num): - reversedNum = int(str(num)[::-1]) - if reversedNum == num: - return True - return False - -allPossibleCombos = [a*b for a in range(999, 99, -1) for b in range(999, 99, -1) if palindromeCheck(a*b)] +allPossibleCombos = [a*b for a in range(999, 99, -1) for b in range(999, 99, -1) if int(str(a*b)[::-1]) == a*b] print("The largest palindrome made from the product of two 3-digit numbers is %s" % max(allPossibleCombos))