Python - Ayuda problemas python


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.

For example:

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:
Mercury: 314.623

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

Mercury: 277.442
Venus: 664.886
Earth: 735.845
Mars: 279.124
Jupiter: 1922.011
Saturn: 825.103
Uranus: 672.382
Neptune: 842.741
Pluto: 50.388
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil

Ayuda problemas python

Publicado por Jua Carlos (5 intervenciones) el 16/07/2017 23:04:27
Hola Juan, la idea es: con los datos que te dan de cada planeta, calcular su volumen y luego su masa.
Para posteriormente, usando la fórmula de la gravitación universal, hallar la aceleración de la gravedad
de cada planeta. Es con esta gravedad que podrás obtener el peso del objeto en cada uno de los planetas.
Si tienes problemas en el código fuente puedes escribirme a mi correo:
Un saludo
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil