I've recently taken up learning to program the "Right Way" again, and so as a mark of progress I offer the below.An implementation of FizzBuzz as specified by Jeff Atwood in Python. This being a Python implementation where there is only one right way, there are probably identical solutions to this on the net already. Passing the FizzBuzz is as Atwood himself said nothing to be especially proud of. Yet for some God damned reason I am offering the below:
def main(): for i in range (100): if i % 3 == 0 and i % 5 == 0: print "FizzBuzz" else: if i % 3 == 0: print "Fizz" if i % 5 == 0: print "Buzz" else: print i main()
For anyone who might want to follow the text I'm relearning programming in, I am reading John Zelle's Python Programing: an Introduction to Computer Science (first edition). The next language up will probably be Scheme. Eventually Perl will probably happen, but not for any noble reason.