On 22 February 2012 12:57, David Craig <dcdavem...@gmail.com> wrote: > Hi, > I have a function that calculates the distance between two points on a > sphere. It works but I cant get it to return a float for use in another > script. Anyone know how I do that?? >
<snip code> > cos = (math.sin(phi1)*math.sin(phi2)*math.cos(theta1 - theta2) + > math.cos(phi1)*math.cos(phi2)) > arc = math.acos( cos ) > type(arc) > arc = arc*6378.1 > #print str(arc*6378.1)+' km' > # Remember to multiply arc by the radius of the earth > # in your favorite set of units to get length. > return arc Hi David, I'm a bit puzzled. A few lines above the return, you have 'type(arc)'. Try replacing that with 'print type(arc)' and also include 'print type(arc)' immediately above your return. I think you will find that the code you posted does return a float. Best, Brian vdB _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor