Op 2010-07-28 11:41, David Hutto schreef: > From a practice exercise in Building Skills In Python page 64 I'm > working on How Much Does The Atmosphere Weigh? Part 1: > To check it states that the answer should be app. 10**18kg However, > and I've checked to make sure that the math I've layed out matches up > with the texts, I get 5.07360705863e+20
Are looking for the _weight_ or the _mass_? They're the same in everyday usage, but not in physical contexts. As far as I can see, you're calculating the mass, not the weight. Does the book mention the units? If it's kg, it's mass they mean, if it's N, it's weight. In case they're really after the weight, your calculations get simpler: import math def atmosphereWeight(): # Air pressure at sea level P0 = 1.01325e5 # Approx. radius of earth R = 6.37e6 # Approx. surface area of earth A = 4 * math.pi * R**2 # Weight of atmosphere [units: N/m**2 * m**2 = N] Wa = P0 * A return Wa Using that I get approx. 5.17e19, which is about 50 times larger than the 1e18 value in the book. I guess my guess was incorrect, and they're really after the mass (which, according to my calculations, is 5.17e19 / 9.81 = 5.27e18; 'only' about 5 times larger than the value in the book). -- The saddest aspect of life right now is that science gathers knowledge faster than society gathers wisdom. -- Isaac Asimov Roel Schroeven _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor