From 1c2182838ecd766e0a2592025e3220b99e0cca18 Mon Sep 17 00:00:00 2001 From: Oliver Sampson Date: Mon, 29 Mar 2021 11:29:46 +0200 Subject: [PATCH] Change first function to match second function The two functions for diversity were not equivalent. --- book/ch02.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/ch02.rst b/book/ch02.rst index 4e22f4ce..3c4a3429 100755 --- a/book/ch02.rst +++ b/book/ch02.rst @@ -992,7 +992,7 @@ function. Here's the function we saw in sec-computing-with-language-texts-and-w >>> from __future__ import division >>> def lexical_diversity(text): - ... return len(text) / len(set(text)) + ... return len(set(text)) / len(text) We use the keyword ``return`` to indicate the value that is produced as output by the function. In the above example,