[Tutor] Newbie question

Alan Gauld alan.gauld at freenet.co.uk
Tue Apr 19 09:24:02 CEST 2005


> def square(y):
>    return y * y
> 
> for x in range(1, 11):
>    print square(x),
> 
> print
> 
> Well, I understood the code above. My question is: Is
> it really necessary I have the last "print" statment

No, it just creates a blank line which makes it easier to separate 
the output of the program from the other stuff on the screen. 
Its a convenience feature which although not essential helps 
the user see the results.

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld


More information about the Tutor mailing list