fork download
  1. # your code goes here
  2. #code
  3. tree_symbol = '*'
  4. ornaments = ['@', '#', '&']
  5.  
  6.  
  7. # 1 VERSION
  8. print("\n1 VERSION")
  9. # print top
  10. print(' '*9+'+')
  11.  
  12. for i in range(9):
  13. # create empty line before tree
  14. line_empty = list(' ' * (9-i))
  15. # create line of the tree (consisting '*' chars)
  16. line_tree = list(tree_symbol * (i*2+1))
  17.  
  18. # apply ornaments seperately
  19. ornament_index = 0
  20. for j in range(len(line_tree)):
  21. # every second tree field, apply ornament
  22. if j%2 == 0:
  23. line_tree[j] = ornaments[ornament_index % len(ornaments)]
  24. ornament_index += 1
  25. print(''.join(line_empty+line_tree))
  26.  
  27.  
  28.  
  29.  
  30.  
  31. # 2 VERSION
  32. print("\n2 VERSION")
  33. # print top
  34. print(' '*9+'+')
  35.  
  36. ornament_index = 0
  37. for i in range(9):
  38. # create empty line before tree
  39. line_empty = list(' ' * (9-i))
  40. # create line of the tree (consisting '*' chars)
  41. line_tree = list(tree_symbol * (i*2+1))
  42.  
  43. # apply ornaments seperately
  44. for j in range(len(line_tree)):
  45. if j%2 == 0:
  46. # every second tree field, apply ornament
  47. line_tree[j] = ornaments[ornament_index % len(ornaments)]
  48. ornament_index += 1
  49. print(''.join(line_empty+line_tree))
Success #stdin #stdout 0.02s 27712KB
stdin
Standard input is empty
stdout
1 VERSION
         +
         @
        @*#
       @*#*&
      @*#*&*@
     @*#*&*@*#
    @*#*&*@*#*&
   @*#*&*@*#*&*@
  @*#*&*@*#*&*@*#
 @*#*&*@*#*&*@*#*&

2 VERSION
         +
         @
        #*&
       @*#*&
      @*#*&*@
     #*&*@*#*&
    @*#*&*@*#*&
   @*#*&*@*#*&*@
  #*&*@*#*&*@*#*&
 @*#*&*@*#*&*@*#*&