challenges icon indicating copy to clipboard operation
challenges copied to clipboard

PCC13 - the provided test is quite strange

Open pajdekPL opened this issue 2 years ago • 0 comments

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},
}

pajdekPL avatar Feb 14 '23 17:02 pajdekPL