Ad
  • Custom User Avatar
  • Custom User Avatar

    Even though there is some redundancy here, is this solution a better example of Python's "explicit over implicit", "Sparse is better than dense", and "Readability counts". I am not a regular Python coder, and I find this solution to be more readable at a glance than the one-liner. Is the one-liner more idiomatic and therefore more readable once you become more familar with Python?

  • Custom User Avatar

    Think about what you are asking the code. You are asking the computer to evaluate if the above statment is true (boolean analysis). You are then asking it to return true if it is true, false if it is false. This is redundant. Better to just ask it to return to result of boolean evaluation, as the dffuller is saying. The result of teh conditional operation "if" is the boolean result.

  • Custom User Avatar

    the code form

    if <boolean statement>:
      return true
    else:
      return false
    

    is an antipattern. instead use

    return <boolean statement>
    
  • Custom User Avatar

    Right on! The description has been changed

  • Custom User Avatar

    BusinessMEN? Women can work in business too!! It might seem like a nitpicky detail to you, but it's amazing how the things we read and see and hear every day feed into ingrained prejudices. Could you please change the wording of the question? Thank you.