Ad
  • Custom User Avatar

    You have a misunderstanding of something. n is a number. str(n) turns it into a string. strip just removes the leading and trailing characters. All of this 'launches' in both cases. The int throws an error if it receives an empty string, which is the case if input is only zeros, since you strip them.

  • Custom User Avatar

    It doesn't skip anything. Python's or statement returns the left side if it is true and with strings that is whenever the string is not empty. Only when the left side is false does it proceed to evaluate the right side and it returns it regardless of is it true or false.