Myan cube temple and cosine wave

Hello,
the Cube method is what made the temple thingy, the Cube_func method is what made the cosine wave thing.

import bpy
import math as m
import cmath as c

'uses recursion to make a tower thingy'
def Cube(x,y,z,step):
    loc = [x,y,z]
    # adds a cube
    bpy.ops.mesh.primitive_cube_add(view_align=False, 
    enter_editmode=False, location=loc,rotation=(0, 0, 0), 
    layer=(True, False, False, False, False, False, 
    False, False, False, False, False, False, False, 
    False, False, False, False, False, False, False,
     False, False, False, False, False, False, False,
     False, False, False, False, False))
    #scales the cube    
    bpy.ops.transform.resize(value=(step,step, step),
     constraint_axis=(False, False, False), 
    constraint_orientation='GLOBAL', mirror=False, 
    proportional='DISABLED', proportional_editing_falloff='SMOOTH',
     proportional_size=1, snap=False, snap_target='CLOSEST', 
    snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0),
     release_confirm=False)
    #keeps creating cubes as long as condition is met
    if(z>1):
        Cube(x,y,z-.8,step+.2)


'uses recursion to plot a function based on x'
def Cube_func(x,step):
    #function of where y position should go
    func = m.tan(x)
    y=z=0
    loc = [x,func,z]
    bpy.ops.mesh.primitive_cube_add(view_align=False, 
    enter_editmode=False, location=loc,rotation=(0, 0, 0), 
    layer=(True, False, False, False, False, False, False, False,
     False, False, False, False, False, False, False, False, False,
     False, False, False, False, False, False, False, False, False,
     False, False, False, False, False, False))
        
    bpy.ops.transform.resize(value=(step,step, step), 
    constraint_axis=(False, False, False), 
    constraint_orientation='GLOBAL', mirror=False, 
    proportional='DISABLED', proportional_editing_falloff='SMOOTH', 
    proportional_size=1, snap=False, snap_target='CLOSEST',
     snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0),
     release_confirm=False)
    if(x<20):
        Cube_func(x+1,step-.02)

#Cube_func(-20,1)
Cube(0,0,20,1)