Help us understand the problem. What is going on with this article?

問題

これを2進数に変換して逆から並べ、
さらに10進数に戻したとき、

1. YYYYMMDDのフォーマット -> 19660713
2. 2進数に変換 -> 100101011111111110101001
3. 2進数を逆か並べる -> 1001010111111111110101001
4. 逆から並べた2進数を10進数に戻す -> 19660713
・・・1966年7月13日（最初の数）に戻る

回答

answer.py
```from datetime import datetime
from datetime import timedelta

from_date = datetime(1964, 10, 10)
to_date = datetime(2020, 7, 24)

def return_reversed_number(n):
binary_date = format(int(n.strftime("%Y%m%d")), "b")
reversed_number = int(binary_date[::-1], 2)
return reversed_number

def daterange(_from, _to):
for i in range((_to - _from).days):
yield _from + timedelta(i)

for j in daterange(from_date, to_date):
if int(j.strftime("%Y%m%d")) == return_reversed_number(j):
print(j)
else:
pass

```

つまづいたところ

10進数、2進数の相互変換は過去に触れましたので、

ググってみると簡単に出てきたのでそのままコピペでいけました。

しかし、それだと求める期間が変更になったときの拡張性が乏しいみたいです。
なので検索する範囲を絞らない方法の方でPythonに書き換えています。

つまづいたといえば、

Why do not you register as a user and use Qiita more conveniently?
1. We will deliver articles that match you
By following users and tags, you can catch up information on technical fields that you are interested in as a whole
2. you can read useful information later efficiently
By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
1. We will deliver articles that match you
By following users and tags, you can catch up information on technical fields that you are interested in as a whole
2. you can read useful information later efficiently
By "stocking" the articles you like, you can search right away