how to use sorted with key of bool in python?

False == 0 and True == 1 which makes False < True just as 0 < 1. So the keys of your list are sorted in ascending order:

[False, False, False, False, False, True, True]