An astrophysics lab is developing software to calculate the escape velocity of various exoplanets.
The formula to calculate the escape velocity of a spherical celestial body is:
v=2GMR v = \sqrt{\frac{2GM}{R}} v=R2GMA program and subprogram have been started to carry out this calculation, but are incomplete.
Q05.py:# Q05.py - Unfinished program
# Do not change the existing input statements
def calculate_escape_velocity():
# Add parameters and calculation here
pass
# Main program
mass = float(input("Enter the mass of the planet (kg): "))
radius = float(input("Enter the radius of the planet (m): "))
# Call the subprogram and print the formatted result
Amend the program and subprogram to meet the following requirements:
11186.273 or 2375.400).Do not add any additional functionality.
Save your amended code as Q05FINISHED.py
29 exam-style questions on Edexcel GCSE Computer Science Subprograms, covering Built-in and user-devised subprograms, Functions versus procedures, and Global and local variables. Each one has a worked solution and a mark scheme showing where the marks go.