Ask Your Question

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

asked 2020-09-07 10:48:23 -0600

Hoeckin gravatar image

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")


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2020-09-08 03:15:31 -0600

tmonteil gravatar image

updated 2020-09-08 03:15:47 -0600

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)                                                                                                                                                             
edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools


Asked: 2020-09-07 10:48:23 -0600

Seen: 21 times

Last updated: Sep 08