mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-19 19:03:02 +08:00
Simplify code by dropping support for legacy Python (#1143)
* Simplify code by dropping support for legacy Python * sort() --> sorted()
This commit is contained in:
@ -6,18 +6,10 @@ the product of two 2-digit numbers is 9009 = 91 x 99.
|
||||
Find the largest palindrome made from the product of two 3-digit numbers which
|
||||
is less than N.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
try:
|
||||
raw_input # Python 2
|
||||
except NameError:
|
||||
raw_input = input # Python 3
|
||||
|
||||
|
||||
def solution(n):
|
||||
"""Returns the largest palindrome made from the product of two 3-digit
|
||||
numbers which is less than n.
|
||||
|
||||
|
||||
>>> solution(20000)
|
||||
19591
|
||||
>>> solution(30000)
|
||||
@ -47,4 +39,4 @@ def solution(n):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(solution(int(raw_input().strip())))
|
||||
print(solution(int(input().strip())))
|
||||
|
Reference in New Issue
Block a user