Ask Your Question

# How do you sort Beker and Piper characteristic frequencies in order from least common to most common frequency?

Hello, I am trying to figure out how to sort the characteristic frequency of each letter in the table for beker and piper. I currently only have the code that will output the beker and piper table in order from the alphabet but I was wondering if there is a way to sort them from least to greatest based on their frequency?

Any information helps and here is the code I have so far

N = AlphabeticStrings()

table = N.characteristic_frequency(table_name="beker_piper")

sorted(table.items())

edit retag close merge delete

## 1 Answer

Sort by ยป oldest newest most voted

You can provide a key function to sort with, as follows (say you want the most frequent letter first):

sage: sorted(table, key=table.get, reverse=True)
['E',
'T',
'A',
'O',
'I',
'N',
'S',
'H',
'R',
'D',
'L',
'C',
'U',
'M',
'W',
'F',
'G',
'Y',
'P',
'B',
'V',
'K',
'J',
'Q',
'X',
'Z']

more

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2020-09-07 17:48:23 +0200

Seen: 31 times

Last updated: Sep 08 '20