MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / is_palindrome

Function is_palindrome

project_euler/problem_055/sol1.py:30–40  ·  view source on GitHub ↗

Returns True if a number is palindrome. >>> is_palindrome(12567321) False >>> is_palindrome(1221) True >>> is_palindrome(9876789) True

(n: int)

Source from the content-addressed store, hash-verified

28
29
30def is_palindrome(n: int) -> bool:
31 """
32 Returns True if a number is palindrome.
33 >>> is_palindrome(12567321)
34 False
35 >>> is_palindrome(1221)
36 True
37 >>> is_palindrome(9876789)
38 True
39 """
40 return str(n) == str(n)[::-1]
41
42
43def sum_reverse(n: int) -> int:

Callers 1

solutionFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected