Open Kester00 opened 3 years ago
@Kester00 I'm not certain, but I think the request is more about explaining how unpacking works than about iteration over FreqDist. That is, how for (char, count) in fdist.most_common()
assigns values to both char
and count
. This could be explained in Chapter 1, sections 2.3 (regarding assignment) and 4.3 (regarding for-loops). If this is the first time unpacking is used in the book, it also wouldn't be bad to explain as you suggest.
There is an unexplained header found in subsection "Accessing Individual Characters", with the message below: [sb] | explain this tuple unpacking somewhere?
Recommended fix: Explain to readers that the tuples in the FreqDist are expressed in the form (char, count) and that the list comprehension [char for (char, count) in fdist.most_common()] extracts a list the alphabet characters and orders them in decreasing frequency.