July 27, 2004 | GPL Compliance for Software Developers | Python |
def triangle (n): rows = 1 << n;
for i in range (rows): line = [] for j in range (i): line.append (" ") for j in range (rows): if i & j: line.append (" ") else: line.append ("**")
print ''.join (line)
from triangle import triangle
triangle (3)
Previous Top |
![]() |
Copyright © 2004, Free Software Foundation. Verbatim copying permitted provided this notice is preserved. |