Introduction
Welcome to the LabEx Space Academy's Python Function and Module Challenge! As a new space cadet, you'll be completing a simple space mission calculator. This challenge will help you practice defining functions and using them from another file.
Complete the Space Mission Calculator
In this challenge, you will complete a partially created Python module and use it in a main program.
Tasks
- Open the file
space_math.pyin the/home/labex/projectdirectory. (Recommend to use WebIDE) - Complete the three functions in
space_math.py:calculate_fuel(distance)time_to_destination(distance, speed)gravity_force(mass1, mass2, distance)
- Open the file
mission_planner.pyin the same directory. - Import the functions from
space_math.pyand use them to calculate mission details.
Requirements
- Complete the functions in
space_math.pyusing the formulas provided in the comments. - In
mission_planner.py, import the functions fromspace_math.pyusing thefrom ... import ...syntax. - Use the imported functions to calculate and display the mission details.
- Round all calculations to two decimal places in the output.
Example
After completing and running mission_planner.py, the output should look similar to this:
python ~/project/mission_planner.py
Space Mission Details:
----------------------
Fuel needed: 112500000000.00 liters
Time to destination: 11250.00 hours
Gravitational force at destination: 12.64 N
Summary
In this challenge, you completed a Python module with space mission calculation functions and used it in a main program. You practiced defining functions, importing them from another file, and using them in calculations. These skills are important for organizing your code and creating reusable components in larger Python projects.



