Skip to content

Issue with exercise "Randomize list" in Functions Advanced #319

@Bothkevin

Description

@Bothkevin

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions