change armature ends with script

how do you change the armature ends with script.

like position the tips with a python script?