Skip to content

Error in functional programming, exercise 3 #312

@SerAcero

Description

@SerAcero

The description says "using lower() to ensure consistent capitalization."

But the proposed solution is missing it:

def reference_exercise3(words: List[str]) -> List[Tuple[str, int]]:
    return [(k, len(list(v))) for k, v in itertools.groupby(sorted(words, key=lambda x: x[0]), key=lambda x: x[0])]

perhaps:

itertools.groupby(sorted(words, key=lambda x: x[0].lower()), key=lambda x: x[0].lower()):

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions