## Find the maximum of a list the long way import numpy as np myList = [2, 10, 4, 7] maxNum = -1.e99 for num in myList: if num>maxNum: maxNum = num print maxNum print np.max(myList) ## print prime numbers and squares for pnum in [1, 2, 3, 5, 7, 11]: print "number=%i, squared=%i" % (pnum, pnum*pnum) ## motion of star ra = 15.2345 dec = -45.23435 pmRa = -1.2 pmDec = 0.35 epoch = 2000. print "ra in 2009 is :%f" % (ra + (pmRa/3600.)*(2009-2000) ) print "dec in 2009 is :%f" % (dec + (pmDec/3600.)*(2009-2000) ) ## when does it cross -45 exactly? deltaDec = -45.-dec deltaTime = deltaDec / (pmDec/3600.) print "The time it takes is %f years" % (deltaTime)