Python Developer
Hello, I am Favour. I am a Python Developer. The Coding Process is a place where I document and consolidate what I learn on my journey towards becoming a software engineer. Kindly join me. I am also a poet and non-fiction writer. You could visit https://favourolumese.medium.com to read my writings. Thank you.
Markdown supported · ⌘↵ to post
Siddharta Govindaraj
Nice. Here is another approach using functions from
itertools. I really like the functions in itertools for these kinds of problemsfrom 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))