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.
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
- Open the file
mission_control.pyin the/home/labex/projectdirectory. (Recommend to use WebIDE) - 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)
- 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.pyusing the appropriate data structures:- Use the
missionslist to store mission names - Use the
mission_detailsdictionary to store details of each mission - Use a set to store unique astronaut names in the
list_astronautsfunction
- Use the
- Ensure that the
add_missionfunction adds the new mission to both themissionslist and themission_detailsdictionary - The
update_missionfunction should modify the specified detail of the given mission - The
display_missionsfunction should print all missions and their details - The
list_astronautsfunction 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!
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.



