how to use random.choice with transform.resize? I would like to resize the columns in z-direction randomly between 0.0, 0.33 or 0.66.

This way it doesn't work (tried the same with rotation, that does worked).

Anybody knows how it will work?
Thanks a lot!

import bpy

def Column(pos_X, pos_Y, pos_Z, dim_X, dim_Y, dim_Z):
    bpy.ops.mesh.primitive_cube_add(location=(pos_X , pos_Y, pos_Z + dim_Z/2))   #remettre le cube sur la base
    bpy.ops.transform.resize(value=(0.5, 0.5, 0.5))
    bpy.ops.transform.resize(value=(dim_X, dim_Y, dim_Z))

def Columns():
    for i in range(0,4):
        for j in range(0,4):
            Column((i*0.33)-((4/2)*2)+3.5,(j*0.33)-((4/2)*2)+3.5,0,0.01,0.01,1)
            bpy.context.object.name = "COLUMNS"
            bpy.data.objects["COLUMNS"].select = True
            bpy.context.object.name = "COLUMNS.001"
            bpy.data.objects["COLUMNS.001"].select = True
            bpy.ops.object.join()     
            bpy.context.object.name = "COLUMNS"
            bpy.data.objects["COLUMNS"].select = True
            bpy.context.object.name = "COLUMNS.001"
            bpy.data.objects["COLUMNS.001"].select = True
            bpy.ops.object.join() 

Columns()

bpy.ops.object.origin_set(type='ORIGIN_CURSOR', center='MEDIAN')
scale = random.choice[(0,0.33,0.66)]
bpy.ops.transform.resize(value=(1, 1, 1*scale))
You need to make two small changes to make your script run - add import random and the call to random.choice you have the function brackets and array brackets back to front.

import bpy
import random
...
...
...
scale = random.choice([0,0.33,0.66])
bpy.ops.transform.resize(value=(1, 1, 1*scale))


Also I think the end result may not be what you are after, I expect you want to move the random size into the column creation to make each column a different size.