Page 1 of 1

Refer to your Space Weight code (you may also use my solution). Previously, we had used dictionaries to hold the gravity

Posted: Tue Jul 12, 2022 8:17 am
by answerhappygod
Refer To Your Space Weight Code You May Also Use My Solution Previously We Had Used Dictionaries To Hold The Gravity 1
Refer To Your Space Weight Code You May Also Use My Solution Previously We Had Used Dictionaries To Hold The Gravity 1 (202.29 KiB) Viewed 28 times
Code in Python. References space_weight.py provided atbottom.
Refer to your Space Weight code (you may also use my solution). Previously, we had used dictionaries to hold the gravity differential to Earth. Now, create a planet class that stores the name of the planet along with the gravity differentials of each planet. Then, create a method calculate_spaceweight in the planet class that will take a weight and return what the weight will be on the given planet. Create a list of planets and then use a loop to calculate your weight on each planet. The output should look like this:
Please enter weight: 150 Your weight on Mercury is 57.0 Your weight on Venus is 136.5 Your weight on Mars is 57.0 Your weight on Jupiter is 351.0 Your weight on Saturn is 139.5 Your weight on Uranus is 138.0 Your weight on Neptune is 168.00000000000003 Your weight on Pluto is 93.0 Ms a reminder, here are the space weights: Mercury: 0.38 Venus: 0.91 Mars: 0.38 Supiter: 2.34 Pranus: 0.92 Pluto: 0.62