Skip to content

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

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

Open
Bothkevin opened this issue May 9, 2025 · 0 comments · May be fixed by #320
Open

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

Bothkevin opened this issue May 9, 2025 · 0 comments · May be fixed by #320
Assignees
Labels
advanced tutorial bug Something isn't working

Comments

@Bothkevin
Copy link

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.

@Bothkevin Bothkevin added the bug Something isn't working label May 9, 2025
@edoardob90 edoardob90 linked a pull request May 9, 2025 that will close this issue
@edoardob90 edoardob90 changed the title Issue in test_12_functions_advanced with reference_randomize_list Issue with exercise "Randomize list" in Functions Advanced May 10, 2025
@edoardob90 edoardob90 self-assigned this May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
advanced tutorial bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants