Ad
  • Custom User Avatar

    I would sat that using multiple if statements is a slightly better practice over if ... elif ... elif ... whenever the condition for all of the ifs is both consistent and clearly exclusionary. In this case, both of those are met since it is an inate logical idea in programming that if a variable equals a character, then it cannot also equal a different character.

    Using only if statements makes the code sligtly easier to read, especially for those who use any of the braced langagues (Java, C#, JavaScript, etc) where you have to use if (condition) {...} else if (condition) {...} else if (condition) {...} else {...} instead of elif.

    But I 100% agree that using a ternary instead of just returning an equality expression is not a best practice.

  • Default User Avatar

    My appologies. New format is also available, and I belive preferred, in 2.7 as well.
    See https://docs.python.org/2.7/library/string.html#string-formatting

  • Custom User Avatar

    Test Failurer: '1 ** b */ 1' should equal '1 * 1'

    This seems like a typo in one of the internal tests. I believe the test is missing a slash ('/') between the stars. As it stands, the test is requiring that a single star be treated as the start of a comment.

  • Default User Avatar

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

  • Default User Avatar

    All tests pass except for this one:

    Failing test: 144991 should equal 'Error 404'

    Even forcing an
    if int(x) == 144991: return 'Error 404'