from easybits import Bits from ciphers.caesar import CaesarCipher from collections import Counter def crack_caesar(enc_text): counts = Counter(enc_text) count_keys = list(counts.keys()) count_vals = list(counts.values()) most_freq=counts.most_common(1)[0][0] print(type(most_freq)) secret_num = Bits(most_freq).int - Bits(' ').int cipher = CaesarCipher(secret_num) print(cipher.decrypt(enc_text))