From 5add43f07c2372a84d65e93fbfdb83bc95db0ac9 Mon Sep 17 00:00:00 2001 From: daviddoji Date: Sat, 2 Oct 2021 18:49:03 +0200 Subject: [PATCH] Add is_palindrome function --- src/Python/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Python/utils.py b/src/Python/utils.py index 1cea441..6be3763 100644 --- a/src/Python/utils.py +++ b/src/Python/utils.py @@ -41,4 +41,8 @@ def list_primality(n): # Returns all the prime numbers less than or equal to n, in ascending order # For example: list_primes(97) = [2, 3, 5, 7, 11, ..., 83, 89, 97]. def list_primes(n): - return [i for (i, is_prime) in enumerate(list_primality(n)) if is_prime] \ No newline at end of file + return [i for (i, is_prime) in enumerate(list_primality(n)) if is_prime] + + +def is_palidrome(num): + return str(num) == str(num)[::-1] \ No newline at end of file