Chapter 12 – Python While Loop

Step 1
Open any text editor (gedit,pico,vi,nano) then enter the following python script and save the file with .py extension.
#Author : Jijo K Jose
print "\n————————————\nChapter 12 – While Loop \n————————————\n"
 i = input("Enter an integer : ")
 while(i > 0):
  print i
  i -= 1
 c = input("To quit press 0 : ")
print "\n————————————–\n"

Step 2
Change file permission to executable using chmod command.
Step 3
Execute the python file.



You can leave a response, or trackback from your own site.

Leave a Reply