Space Mission Management System

PythonPythonBeginner
Practice Now

Introduction

Welcome to the LabEx Space Academy's Python Data Structures Challenge! As a new recruit, you'll be completing a simple space mission management system. This challenge will help you practice using Python data structures like lists, dictionaries, and sets.

This is a Challenge, which differs from a Guided Lab in that you need to try to complete the challenge task independently, rather than following the steps of a lab to learn. Challenges are usually a bit difficult. If you find it difficult, you can discuss with Labby or check the solution. Historical data shows that this is a beginner level challenge with a 92.91% pass rate. It has received a 91.01% positive review rate from learners.

Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL python(("Python")) -.-> python/FunctionsGroup(["Functions"]) python(("Python")) -.-> python/DataStructuresGroup(["Data Structures"]) python/DataStructuresGroup -.-> python/lists("Lists") python/DataStructuresGroup -.-> python/dictionaries("Dictionaries") python/FunctionsGroup -.-> python/function_definition("Function Definition") python/FunctionsGroup -.-> python/arguments_return("Arguments and Return Values") subgraph Lab Skills python/lists -.-> lab-393176{{"Space Mission Management System"}} python/dictionaries -.-> lab-393176{{"Space Mission Management System"}} python/function_definition -.-> lab-393176{{"Space Mission Management System"}} python/arguments_return -.-> lab-393176{{"Space Mission Management System"}} end

Complete the Space Mission Management System

In this challenge, you will complete a partially created Python script that manages space missions using different data structures.

Tasks

  1. Open the file mission_control.py in the /home/labex/project directory. (Recommend to use WebIDE)
  2. Complete the four functions in mission_control.py:
    • add_mission(missions, mission_details, name, details)
    • update_mission(mission_details, name, key, value)
    • display_missions(missions, mission_details)
    • list_astronauts(mission_details)
  3. Run the script and test the functionality by adding a mission, updating it, displaying all missions, and listing astronauts.

Requirements

  • Complete the functions in mission_control.py using the appropriate data structures:
    • Use the missions list to store mission names
    • Use the mission_details dictionary to store details of each mission
    • Use a set to store unique astronaut names in the list_astronauts function
  • Ensure that the add_mission function adds the new mission to both the missions list and the mission_details dictionary
  • The update_mission function should modify the specified detail of the given mission
  • The display_missions function should print all missions and their details
  • The list_astronauts function should return a set of all unique astronauts across all missions

Example

After completing and running mission_control.py, the interaction should look similar to this:

$ python /home/labex/project/mission_control.py

Space Mission Management System
1. Add Mission
2. Update Mission
3. Display Missions
4. List Astronauts
5. Exit

Enter your choice: 1
Enter mission name: Mars Expedition
Enter destination: Mars
Enter launch date: 2030-01-01
Enter crew members (comma-separated): John Doe, Jane Smith

Mission added successfully!

Enter your choice: 3

All Missions:
1. Mars Expedition
   Destination: Mars
   Launch Date: 2030-01-01
   Crew: John Doe, Jane Smith

Enter your choice: 4

All Astronauts:
- John Doe
- Jane Smith

Enter your choice: 5
Exiting Space Mission Management System. Goodbye!
✨ Check Solution and Practice

Summary

In this challenge, you completed a Python script that manages space missions using various data structures. You practiced using lists to store mission names, dictionaries to store mission details, and sets to keep track of unique astronauts. This exercise reinforced your understanding of Python data structures and their practical applications in managing complex data.

OSZAR »