Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PCC13 - the provided test is quite strange #867

Open
pajdekPL opened this issue Feb 14, 2023 · 0 comments
Open

PCC13 - the provided test is quite strange #867

pajdekPL opened this issue Feb 14, 2023 · 0 comments

Comments

@pajdekPL
Copy link

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},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant