#! bpy
"""
Name: 'berlin-clock.py'
Blender: 27x
Group: 'Example'
Tooltip: 'Construct a berlin-clock'
"""
import bpy

clock = ["#",
         "####",
         "####",
         "###########",
         "####"]


def create(object):
    "Create and compose a berlin-clock"
    
    rows = len(object)
    distances = [9.5, 3.75, 3.75, 1.6, 3.75]
    for row in range(rows):
        cols = len(object[row])
        for col in range(cols):
            distance = distances[row]
            x = row * 3
            y = col * distance + distance
            bpy.ops.mesh.primitive_cube_add(location=(x, y, 0))

            if row == 3:
                bpy.ops.transform.resize(value=(0.5, 0.5, 0.5))

if __name__ == '__main__':
    bpy.ops.object.select_by_type(type='MESH')
    bpy.ops.object.delete()
    create(clock)