Skip to content

PCC13 - the provided test is quite strange #867

Description

@pajdekPL

The provided test is quite challenging due to the fact that it expects to use a dict with a tuple as a key.

https://github.com/pybites/challenges/blob/master/13/test_directors.py#L24

report = sorted(directors.items(), key=lambda x: float(x[0][1]), reverse=True)
To pass this test the dict has to be in this format:

{
(director, avg_score): movies,
}

Is it good practice to have a tuple as a key for dictionaries?

It seems that those formats would be more readable and useful:

{
director: (avg_score, movies),
}

{
director: {'avg_score': avg_score, 'movies': movies},
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions