fork(3) download
  1. def f(indent, num):
  2. if(num != 0):
  3. f(indent, num/2); # print previous pattern
  4. print " "*indent + "*"*num; # print middle row of *'s
  5. f(indent + 1, num/2);
  6.  
  7. print "f(0,0):"
  8. f(0,0)
  9. print "=================="
  10. print "f(0,2):"
  11. f(0,2)
  12. print "=================="
  13. print "f(0,4):"
  14. f(0,4)
  15. print "=================="
  16. print "f(0,8):"
  17. f(0,8)
Success #stdin #stdout 0.01s 7852KB
stdin
Standard input is empty
stdout
f(0,0):
==================
f(0,2):
*
**
 *
==================
f(0,4):
*
**
 *
****
 *
 **
  *
==================
f(0,8):
*
**
 *
****
 *
 **
  *
********
 *
 **
  *
 ****
  *
  **
   *