# While20.py (c) Kari Laitinen # http://www.naturalprogramming.com # 2006-04-18 File created. # 2022-12-16 Converted to Python 3. # The print() function prints a newline after each # printing operation unless there is , end="" ) at the end # of the print call. # 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, end="" ) number_to_print += 1 print( "\n" )