CS111 Lab 3: Escape Velocity

Image Source
Luna 1 was a lunar impactor launched by the Soviet Union in 1959 and was the first man-made object to reach escape velocity from Earth, first to reach (and miss) the Moon, first to (accidentally) leave geocentric orbit, and first to enter a heliocentric orbit.
This lab requires one program, but the program will go through a few iterations.
Program 1: Escape Velocity
- Write a program that calculates the escape velocity for a given gravity, mass, and distance from center of gravity. Use the formula for escape velocity. Square root is available as the sqrt() function in the math library. Use the input() function to collect user input. Test the program on Earth and Mars. Print out escape velocity both in km/s and mph. Your program must perform all calculations in SI units.
- Make a function that calculates escape velocity and accepts parameters for M and r. You can do this as part of step 1 if you wish. The function should NOT call input or print. Rather, it should take two parameters, and return one value. Additionally, it should be named in such a way that what it does is easily understood (e.g. retEscVel() and not something like function1())
- Add support to compare two planets (i.e. ask for characteristics for two different planets, then output both escape velocities). The program does not have to make any judgment concerning the relative escape velocities for each planet in this step. Use the function from the previous step to calculate both escape velocities.
- Use the turtle graphics module to draw a bar graph comparing the escape velocities of the two planets.