Jan 1, 2013

Chapter 11 - Python For Loop


 


Step 1


 


Open any text editor (gedit,pico,vi,nano) then enter the following python script and save the file with .py extension.


 




#!/usr/bin/python


#Author : Jijo K Jose


 


print "\n------------------------------------\nChapter 11 - For Loop \n------------------------------------\n"


 


for i in range(10,25,2):


  print i


 


print "\n--------------------------------------\n"


 


#END





 


Step 2


 


Change file permission to executable using chmod command.


 


Step 3


 


Execute the python file.


 


python-for-loop-11


 




 

No comments:

Post a Comment