Ad
  • Default User Avatar

    Even with everything commented out, I get the following error when I press the Test button.

    Traceback (most recent call last):
      File "/workspace/default/tests.py", line 3, in <module>
    Test.assert_equals(order("is2 Thi1s T4est 3a"), "Thi1s is2 3a T4est")
    ^^^^
    NameError: name 'Test' is not defined. Did you mean: 'test'?
    
  • Default User Avatar

    The explanations I have seen suggest that for short lists sorting and slicing can be faster but sorted() starts to chug on big lists, so min() max() is better practice when you don't know how big the list is going to be.

  • Default User Avatar

    "Pythonic" does not mean writing things in as few lines as possible. "Pythonic" is about simplicity and ease of readability. The interpreter doesn't care if you wrote this in one line or 5, but the person who comes behind you to maintain your code will. This code gives very little understanding of what the function is actually trying to accomplish. So, if you didn't write it yourself you might be hard pressed to know how to fix it if it broke.

  • Default User Avatar