Ad
  • Custom User Avatar

    Not a kata issue, you're supposed to return a new Vector not a list.

  • Custom User Avatar

    You have to return a Vector object with the new values from add or whatever.

  • Custom User Avatar

    This statement --> Raise a ValueError if there isn't enough money to withdraw should be clear enough, not a kata issue!

  • Custom User Avatar

    Same problem!

  • Default User Avatar

    I have same problem and i will very happy if someone help with this problem :)

  • Custom User Avatar

    don't mutate the instances.

  • Default User Avatar

    Python: Issues with (Possibly) test cases? This is odd. My code runs fine on my IDE. My equals function returns true or false and my athrmeitc functions reference my equals function and raise exception if the two vectors are different lengths. When tested "a.add(b).equals()' gives AttributeError: 'list' object has no attribute 'equals' becuase the response from my add function is another list, as the sum of the two vectors. are we meant to instantiate another Vector class as the response and check if it is equal to one or both input vector objects?

    Can someone explain how to make the equals function pass through the test cases? or restate what is expected here?

  • Custom User Avatar

    (author here :)

    You are right that this is not "best practice", because there is too much going on. This would be more readable and understandable when broken into a full loop and clear if/else statements.

    On the other hand, list comprehensions are useful. I suggest to try to turn your loops into comprehensions, just for the practice. You don't need to always use them, but you will find them handy in some cases.

    Cheers

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution