Euler problem number #4

前端 未结 14 2008
萌比男神i
萌比男神i 2021-01-03 11:00

Using Python, I am trying to solve problem #4 of the Project Euler problems. Can someone please tell me what I am doing incorrectly? The problem is to Find the larg

14条回答
  •  死守一世寂寞
    2021-01-03 11:35

    Here is my solution:

    polindroms = [(x, y, x * y) for x in range(100, 999) for y in range(100, 999) if str(x * y) == str(x * y)[::-1]]
    print max(polindroms, key = lambda item : item[2])
    

提交回复
热议问题