Ad
  • Custom User Avatar

    def init(self): is invisible and always exists while creating an object.

    So if you don't add and args to it, you can pull it down.

  • Custom User Avatar

    false, 0, "", null and undefined all have the property that when used in a if statement that they will equate to false. So it isn't necessary at all.

    As for production code, it is used without the === true. Which is generally done for all if statements. We also don't write code like

    if ((index === 4) === true) {
      // some logic
    }
    
  • Custom User Avatar

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

  • Custom User Avatar

    Practially, it doesn't make any difference. The init method automatically returns none, so you don't need to include that instruction in your code. The 'pass' keyword does nothing, it is basically just a placeholder to keep Python from getting angry that you didn't include an indented block in the init method. If you used an empty return, or return None, you'd get the same results, you're just doing a little more work than you need to.

  • Custom User Avatar

    You can avoid all that reverse( )-ing if you use unshift( ) instead of push( )