Mission Artemis (Python Challenge)

The Artemis program is a Moon exploration program led by the NASA. Its aim is to re-establish a human presence on the Moon for the first time since the Apollo 17 mission in 1972. It will consists of different missions with a long-term goal of establishing a permanent base on the Moon. The intention is also to facilitate further human missions to Mars.

In this challenge, we will focus on two of the main missions of this program:

  • Mission Artemis II which will send 4 astronauts on board the Orion spacecraft to orbit around the Moon and return back to planet Earth
  • Mission Artemis III which will send 4 astronauts on board the Orion spacecraft to approach the Moon, place a lunar Gateway Station, and then use this gateway to send 2 astronauts to descend to the lunar surface and and spend about 6.5 days on the surface.

Our aim is to write a Python program to help the engineers at NASA plan these two missions and check whether the planned missions are safe to launch.

Effectively, before launch, the NASA engineers must check if the spacecraft used for the mission is carrying enough oxygen and food for the crew.

Mission Data

We will use the following values in your program:

Crew and Duration
Mission Crew Days
Artemis II 4 10
Artemis III 4 30
Supplies Needed Per Astronaut Per Day
  • Oxygen per day = 5 units
  • Food per day = 3 units
Spacecraft Capacity
  • Maximum oxygen = 800 units
  • Maximum food = 500 units

Task 1 – Store the Data in Variables

Create variables for:

    crew size
    number of days
    oxygen per day
    food per day
    maximum oxygen
    maximum food
Show me how...
crew = 4
days = 10
oxygen_per_day = 5
food_per_day = 3
max_oxygen = 800
max_food = 500

Python Code:

Task 2 – Ask the User to Choose a Mission

Ask the user to enter a mission number:

  • 2 for mission Artemis II
  • 3 for mission Artemis III

Make sure that the user can only select one of these two options.

Show me how...
mission = input("Select a mission: Enter 2 for Mission Artemis II or 3 for mission Artemis III")

while mission!="2" and mission!="3":
   print("Invalid mission code. Please try again.")
   mission = input("Select a mission: Enter 2 for Mission Artemis II or 3 for mission Artemis III")

Then use an if statement to reset the correct number of days and crew size.

Show me how...
if mission=="2":
   mission_name = "Artemis II"
   spaceship = "Orion"
   crew = 4
   days = 10
elif mission=="3":
   mission_name = "Artemis III"
   spaceship = "Orion"
   crew = 4
   days = 30   

Task 3 – Calculate Supplies Needed

Use the following formulas to estimate the quantity of oxygen and of food that will be required to complete the mission:

    Total oxygen = crew × days × oxygen per day
    Total food = crew × days × food per day
Show me how...
total_oxygen = crew * days * oxygen_per_day
total_food = crew * days * food_per_day

Display the results to the user.

Show me how...
print("Total oxygen needed for this mission: " + str(total_oxygen) + " units")
print("Total food needed for this mission: " + str(total_food) + " units")

Task 4 – Check If the Mission Is Safe

If both oxygen and food are within spacecraft limits, display:

+--------------------------+
|     READY FOR LAUNCH!    |
+--------------------------+

Otherwise, display:

+--------------------------+
|   NOT SAFE TO LAUNCH!    |
+--------------------------+
Show me how...
if total_oxygen<=max_oxygen and total_food<=max_food:
   status = "Ready for launch!"
   print("""
+--------------------------+
|     READY FOR LAUNCH!    |
+--------------------------+
""")
else:
   status = "Not safe to launch!"
   print("""
+--------------------------+
|   NOT SAFE TO LAUNCH!    |
+--------------------------+
""")

Task 5 – Display a Mission Report

Display a mission report showing the following information:

  • Mission name
  • Spaceship
  • Crew size
  • Duration
  • Oxygen needed
  • Food needed
  • Launch status

Exemplar output:

Mission: Artemis II
Spaceship: Orion
Crew: 4
Days: 10
Oxygen needed: 200 units
Food needed: 120 units
Status: READY FOR LAUNCH
Show me how...
print("--- MISSION REPORT ---")
print("Mission: " + mission_name)
print("Spaceship: " + spaceship)
print("Crew: " + str(crew))
print("Days: " + str(days))
print("Oxygen needed: " + str(total_oxygen) + " units")
print("Food needed: " + str(total_food) + " units")
print("Mission Status: " + status)

Extension Task 1 – Safety Buffer

For a mission to be considered safe and ready to launch, the engineers at NASA want to allow 15% extra supplies to both oxygen and food before checking safety.

Your task is to change the code to add this extra buffer to booth the required oxygen and food.

Show me how...
total_oxygen = round(total_oxygen * 1.15,2)
total_food = round(total_food * 1.15,2)

Extension Task 2 – Extra Spaceships and Extra Missions

Add an option at the start of your program to let the user pick a different spaceship to complete a mission.
You could have a collection of spaceships to opt for, each spaceship having its own oxygen and food capacity, e.g.

Spaceship Oxygen Capacity Food Capacity
Orion 800 units 500 units
Space Voyager 1200 units 800 units
Deep Space Explorer 2400 units 1800 units

Create additional missions for Artemis Mission III, Artemis Mission IV and Artemis Mission V, each mission having its own crew size, duration (in days) and spaceship. Remember the final aim of the Artemis program is to set foot on planet Mars!

Mission Crew Days
Artemis II (Moon orbit) 4 10
Artemis III (Moon landing) 4 30
Artemis IV (Lunar station) 6 45
Artemis V (Extended lunar mission) 8 60


unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 3.2 / 5. Vote count: 47

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!