pythonds icon indicating copy to clipboard operation
pythonds copied to clipboard

missing type conversion

Open irunestone opened this issue 8 years ago • 1 comments

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

irunestone avatar Jan 31 '17 12:01 irunestone

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

bnmnetp avatar Feb 03 '17 21:02 bnmnetp