Make a sphere of cubes in Blender using python script
I figured out the solution.  The issue was that once i got out of the embedded while loop the theta value remained at 6.28 instead of returning to 0.0  it was remedied by putting theta = 0.0 in the outer while loop.

lesson of the day When you leave a while loop the values you have made remain the same when you leave, remember to reinitialize them.

here is my sphere of cubes.