Ad
  • Custom User Avatar

    The solution is correct, but I expect this one to be a tad slower, since it evaluates three times. the third one is completely unnecessary since it doesn't chenge the value of the total but still causes assignment, which also has a cost.

    If you were going for read ability, I can see that this is easy to compare against the requirements, but I would make a couple of changes...

    1. instead of the for loop iterator use 'for game in games:' (avoids the range and array math & potential off by one errors)
    2. use meaningful names when getting the values from the split
  • Custom User Avatar

    One line - okay - but good luck giving that to a new engineer, or comparing it to the requirements in a code review, or for that matter remembering what you did three weeks from now. LOL