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

Code failing in test submission but not when run on computer #23

Open
opheron opened this issue Jul 13, 2016 · 4 comments
Open

Code failing in test submission but not when run on computer #23

opheron opened this issue Jul 13, 2016 · 4 comments

Comments

@opheron
Copy link

opheron commented Jul 13, 2016

I have the following code:

def remove_duplicates_in_order(a_list):
    a_list = list(set(a_list))
    new_list = sorted(a_list)
    return new_list

This seems to work when I test in IDLE/Python shell on my own computer, but fails the test on submission. What am I missing?

@opheron opheron changed the title Code failing in test but not when run? Code failing in test submission but not when run on computer Jul 13, 2016
@santiagobasulto
Copy link

That seems right. What error are you getting?

@prestonr83
Copy link

I also am unable to run the test. get following error.

File "/usercode/file.py", line 5
import sys
^
SyntaxError: invalid syntax

@martinzugnoni
Copy link
Contributor

I've just tried executing the code above and the execution worked, but one test is failing.

Remember that you need to keep the original list ordering. When you are converting the list into a set() you are loosing ordering because sets are unordered collections.

@jim-hart
Copy link

I think the confusion comes from this

Important! The elements should be in order.

At first I thought it meant they needed to be in sorted order, but after seeing this post my confusion was cleared up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants