← Back2023-08-25TIL Python int.bit_count()>>> bin(42) '0b101010' # New in version 3.1. >>> (42).bit_length() 6 # New in version 3.10. >>> (42).bit_count() 3