code: def ic(ctext):
      ''' takes ciphertext, calculates index of coincidence.'''
      counts = ngram_count(ctext,N=1)
      icval = 0
      for k in counts.keys():
          icval += counts[k]*(counts[k]-1)
      icval /= (len(ctext)*(len(ctext)-1))
      return icvaf ic(ctext):
      ''' takes ciphertext, calculates index of coincidence.'''
      counts = ngram_count(ctext,N=1)
      icval = 0
      for k in counts.keys():
          icval += counts[k]*(counts[k]-1)
      icval /= (len(ctext)*(len(ctext)-1))
      return icval
docs: takes ciphertext, calculates index of coincidence.