Starting Python – 99 bottles of beer

After a brief discussion on the subject on StackOverflow chat, I’ve decided to try my hand at Python, using the on-line IDE at Ideone.com.
Here is my rendering of “99 bottles of beer” in Python…

I must say I find it a bit of a strange language, and I still have my reserves as far as its use of white space goes. For example:

bottles = 99
while bottles >= 0 :
	if bottles > 1:

why the colons after the while and if statements if the white space already delimits blocks? I can understand it for one-liners, but I would expect it to be unnecessary for block statements, if the indentation tells you where the block begins and ends..

There’ll probably be other musings as I work my way through the language… Comments, suggestions, questions and answers are welcome as always (but, as always, will only be posted here if they add to the content).

About rlc

Software Analyst in embedded systems and C++, C and VHDL developer, I specialize in security, communications protocols and time synchronization, and am interested in concurrency, generic meta-programming and functional programming and their practical applications. I take a pragmatic approach to project management, focusing on the management of risk and scope. I have over two decades of experience as a software professional and a background in science.
This entry was posted in Python and tagged , . Bookmark the permalink.

One Response to Starting Python – 99 bottles of beer

  1. aardmaat says:

    I think it’s a good thing because it indicates that the condition is over (ok, the enter does that to, but what if de condition would be more than one line?) and it reads kind of like a normal human language for me.

Comments are closed.