@siddharta
Software, management, games and photography
Nothing here yet.
Nothing here yet.
Nice. Here is another approach using functions from itertools. I really like the functions in itertools for these kinds of problems from itertools import count, takewhile def is_palindromic(num): return num == int(str(num)[::-1]) def palindromic(max_num): all_numbers = count() nums_palindrome = (num for num in all_numbers if is_palindromic(num)) return takewhile(lambda x: x < max_num, nums_palindrome) output = list(palindromic(500)) print(output) print(len(output))