# While20.py (c) 1997-2006 Kari Laitinen # http://www.naturalprogramming.com # 2006-04-18 File created. # 2006-05-30 Last modification. # The 'print' command in Python is a statement, i.e., # 'print' is a reserved keyword. # The print statement prints a newline after each # printing operation unless there is a comma at the end # of the print statement. The print statement adds a # space character after each printed item. # The while loops in Python programs are logically similar to # the while loops in Java/C++/C# languages. # The internal statements of the loop must be indented. print "\nNumbers from 0 to 20 are the following:\n" number_to_print = 0 while number_to_print <= 20 : print "%d" % number_to_print, number_to_print += 1 # The print statement inside the above loop could alternatively # be written in the following way. # print number_to_print,