Christbäume und prog_langs

>>> print "n".join([(10-a)*' ' + 'x'*2*a + (10-a)*' ' for a in range(10)+[1,1]])

         xx
        xxxx
       xxxxxx
      xxxxxxxx
     xxxxxxxxxx
    xxxxxxxxxxxx
   xxxxxxxxxxxxxx
  xxxxxxxxxxxxxxxx
 xxxxxxxxxxxxxxxxxx
         xx
         xx
>>> 

<?php for($i=1;$i<12; $i++){$a=($i%10==0)?1:$i%10; echo str_repeat(' ',10-$a).str_repeat('x',$a*2).str_repeat(' ',10-$a)."n";}?>

         xx
        xxxx
       xxxxxx
      xxxxxxxx
     xxxxxxxxxx
    xxxxxxxxxxxx
   xxxxxxxxxxxxxx
  xxxxxxxxxxxxxxxx
 xxxxxxxxxxxxxxxxxx
         xx
         xx

Schöner haben es diese Typen gemacht:
via entwicklergolf

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>