[HOME][CV][PUBS][MAC] |
bash export PATH=/usr/local/Anaconda/bin:$PATH source activate base ipython
>>> a = '1234' >>> b = int(a) >>> print a+a >>> print b+b >>> a = '1234.5678' >>> b = float(a) >>> print a+a >>> print b+bTry these examples and think about why you obtain different answers for a+a and b+b in each case (ask Adam if you are unsure).
>>> a = 1234 >>> b = str(a) >>> print a+a >>> print b+b
>>> if x < 0statement from the Section 4.1 tutorial with some of the other logic statements.
bash export PATH=/usr/local/Anaconda/bin:$PATH source activate base ipython
from astropy.table import Table data = Table.read(filename)Note that you can also easily read in text files using numpy.loadtxt.
data = Table.read(filename) RA = data["ra"] Dec = data["dec"]
A room contains 100 light switches that turn 100 lights on or off. Switch 1 controls light 1. Switch 2 controls light 2 etc. The switches are currently set to the "off" position. Outside of the room are 100 people who enter one-by-one: Person 1 flips switches 1,2,3,4...100 Person 2 flips switches 2,4,6,8...100 Person 3 flips switches 3,6,9,12...99 Person 4 flips switches 4,8,12,16...100 .etc. .etc. Person 100 flips switch 100 Use Matplotlib to plot the state of the light switches (i.e. 1 to 100 on the x-axis and either 1 for "on" or 0 for "off" on the y-axis) after Person 10, Person 25 and Person 50 have left the room. After all of the people have entered the room and flipped their assigned switches, which lights are ON?
Department of Physics & Astronomy,
University of Wyoming, 1000 E. University, Dept. 3905, Laramie, WY 82071, USA |
Tel: 307-766-6244 (direct) Fax: 307-766-2652 (group) |
Page maintained (and updated) |