For loop
Chris Angelico
rosuav at gmail.com
Mon Apr 30 06:49:08 EDT 2012
On Mon, Apr 30, 2012 at 8:41 PM, viral shah <shahviral.it at gmail.com> wrote:
> for i in range (5):
> for j in range (i):
> print i
> print " "
The print command (you're clearly using Python 2 here - it's slightly
different in Python 3) by default prints a whole line - that is, it
finishes with a newline or '\n'. You'll find information on how to
suppress that here:
http://docs.python.org/reference/simple_stmts.html#the-print-statement
Hope that helps!
Chris Angelico
More information about the Python-list
mailing list