Main.NestedLoops History

Hide minor edits - Show changes to markup

February 10, 2010, at 10:11 AM MST by 10.84.44.94 -
Added line 3:
Added lines 11-25:
    print
  1. the range of the inside loop can depend on
  2. that of the outer loop:

for i in range(10) :

    for j in range(i, 10) :
        print '*',
    print
  1. a nested loop that prints a multiplication table:

for i in range(1,11) :

    for j in range(1,11) :
        print i*j,'\t',
February 04, 2010, at 08:46 PM MST by 71.196.160.210 -
Added lines 1-12:

(:source lang=python:)

"""Nested loops"""

  1. for and while loops can be nested:

for i in range(4) :

    for j in range(3) :
        print i,j
    print

(:sourceend:)