Ad
  • Custom User Avatar

    OP solved it, closing

  • Default User Avatar

    your nested conditions are difficult to track and will hurt any reasoning you do about the rest of the code. you can write those conditions as early exits instead, without nesting the rest - thereby keeping it sequential:

    if bad:
        return False
    next thing
    

    you've done some printing which is good but maybe you're not printing the relevant pieces of information. if you write out step by step what the program is doing then you can tell from the output where it's going wrong.

    looks like you've since found the bug - you would see through printing that you had very small differences between the values that you compared, this is because floats are typically approximations, and it's incorrect to test wether two approximations are exactly equal

    another thing is to avoid the word "wrong" and instead describe the problem in terms of what happened differently from the desired outcome.

  • Custom User Avatar

    you will not get this error now.