# Rendered image does not show transparency or lighting

I have exactly 1 day experience of Blender so this is sure to be something really basic. I have created a scene with a light and a single cube with translucent material, when I look at the scene through the camera in the Blender UI I see this, which is what I would expect:

but when I look in the rendered PNG file I see this:

i.e. no shading or transparency. I just want the rendered image to match what I see in Blender.

One thing to note - I need to be able to render the image using code only, so telling me which menu/button to use within the UI won't help me.

My script is as follows:

import bpy
import mathutils, math

scene = bpy.context.scene

# Lights
light_data = bpy.data.lights.new('light', type='POINT')
light = bpy.data.objects.new('light', light_data)
light.location = mathutils.Vector((5,5,5))

# Camera
cam_data = bpy.data.cameras.new('camera')
cam = bpy.data.objects.new('camera', cam_data)
scene.camera = cam
cam.location = mathutils.Vector((5, -5, 5))
cam.rotation_euler = (1, -0.5, 1)

# Action
mat = bpy.data.materials.new(name='mat')
mat.diffuse_color = [1, 1, 0, 0.5]
cube = bpy.context.object

cube.data.materials.append(mat)

scene.render.image_settings.file_format = 'PNG'
scene.render.filepath = "cube.png"
bpy.ops.render.render(write_still = 1)


And for the shadows - it seems you don't have a light source next to the cube, if there's no light there can be no shadows, add a light by pressing SHIFT + A and clicking on light, I'd recommend getting a sun so everything is lit and you can check if there are shadows.
bpy.context.scene.render.engine = 'BLENDER_WORKBENCH'