Ayuda problemas python
Publicado por JuanSokoloff
(1 intervención) el 16/07/2017 19:48:08
Hola. Necesito ayuda resolviendo el siguiente problema.
Before we get into assignment question, lets understand the difference between Weight and Mass.
Mass is a measurement of the amount of matter something contains, while Weight is the measurement of the pull of gravity on an object.
Mass is measured by using a balance comparing a known amount of matter to an unknown amount of matter. Weight is measured on a scale.
The Mass of an object doesn't change when an object's location changes. Weight, on the otherhand does change with location.
If you are in a spaceship far between the stars and you put a scale underneath you, the scale would read zero. Your weight is zero. You are weightless. But when you are on Earth, your weight is some units, right? So it doesn't mean that you become massless in space. It's just that weight is calculated based on the force of attraction between you and the Earth (or any other planet).
The Relationship Between Gravity and Mass and Distance
As stated above, your weight is a measure of the pull of gravity between you and the body you are standing on. This force of gravity depends on a few things. First, it depends on your mass and the mass of the planet you are standing on. If you double your mass [M], gravity pulls on you twice as hard. If the planet you are standing on is twice as massive, gravity also pulls on you twice as hard. On the other hand, the farther you are from the center of the planet, the weaker the pull between the planet and your body. The force gets weaker quite rapidly. If you double your distance from the planet, the force is one-fourth. If you triple your separation, the force drops to one-ninth. Ten times the distance, one-hundredth the force. See the pattern? The force drops off with the square of the distance [R]. This force [F] can be written in an equation form as:
This force is applied on both objects equally and in opposite directions, toward each other. The value of G is currently known to be about 6.67e-11 which is why gravity is so weak - you can overcome the force of the entire planet just by jumping!
We're going to assume all planets are perfect spheres. This means you can find the volume [V] of a planet, given its radius [R], with the fomula
like a normal sphere. (Do not specify the value of π as 4.13. Use math module for that.)
We'll also assume they are made of a material which has the exact same density everywhere - so a handful of material from one bit of the planet weighs the same as any other. This means, given a density [D] (in kilograms per cubic metre), and using the volume [V] you worked out, you can compute the mass [M] of the planet with the formula
Assume the units you are using are kilograms and metres.
The input will be M which is the mass of an object in kilograms..
Followed by a number N which will be the total number of planets on which the weight is to be calculated. This will be given as its name, its radius (in metres), and its average density (in kilograms per cubic metre),
Mercury, 2439700, 5427
Print the output as weight (in Newtons) of the object if it were at the surface of each planet, for example:
So, finally, a complete working program should look something like below:
Mercury, 2439700, 5427
Venus, 6051900, 5243
Earth, 6367445, 5515
Mars, 3386000, 3934
Jupiter, 69173000, 1326
Saturn, 57316000, 687
Uranus, 25266000, 1270
Neptune, 24553000, 1638
Pluto, 1173000, 2050