News for hackers. Stuff that matters.
Re:The Coding Interview by achompas on Wednesday October 05, 2011 @12:11PM (#3076238)
It would definitely be contrived. Let's see how contrived! ;)

    class FizzBuzzer():
        def __init__(self, num):
            self.mod3 = num % 3 == 0
            self.mod5 = num % 5 == 0

        def check(self):
            s = ""
            if self.mod3:
                s += "Fizz"
            if self.mod5:
                s += "Buzz"
            print s

    def main():
        buzzer = FizzBuzzer(n)
        buzzer.check()
Yeah, that's really contrived. Still, you display a familiarity with encapsulation, objects & their attributes/methods, etc.
Re:The Coding Interview by Harkins on Thursday October 06, 2011 @12:06AM (#3078975)
Sorry to nitpick, but it fails to give "FizzBuzz" for 15 and other multiples of 3 and 5.