pythonds
pythonds copied to clipboard
missing type conversion
Error reported in course pythonds on page Exercises by user aw9677 [email protected] Line 15 of the solution to activity 12.7 is missing the conversion to list, currently it reads: keys = letter_count.keys() And it should read: keys = list(letter_count.keys())
In general there is no need to convert dictionary.keys() to a list unless you are looking for backward compatibility with Python 2. This is one case where the underlying implementation of python in the browser is not fully python3, and does not act like python3.
The given code works fine, but should be written:
keys = letter_count.keys()
for char in sorted(keys):