python-tutorial
python-tutorial copied to clipboard
Issue with exercise "Randomize list" in Functions Advanced
Describe the bug The test tries to compare two randomized lists, and passes if they are the same.
Even with the proposed solution, the test does not pass 2/2
To Reproduce Use the proposed solution, and run the cell:
`def solution_randomize_list(my_list: list[int]) -> list[int]: """ A function that randomizes the order of the elements in a list.
Args:
my_list: A list of integers
Returns:
- A new list with the elements of `my_list` in random order
"""
return sorted(my_list, key=lambda x: random.random())`
Expected behavior The test should pass with 2/2 green. However, since it compares random lists with each other, the passing rate is also random.