4.11. Project: Data & Variables

In this project, you are going to write code to display a fictional Launch Checklist, which includes information about the spaceship, astronauts, and fuel.

4.11.1. Before You Start

If your teacher uses a Trinket course, follow the links for instructions on how to access this project.

If you are working through this material on your own, use this standard repl or this Trinket to access the starter code.

To save and share your code, be sure to login to your account.

4.11.2. Declare and Assign Variables

Declare and assign a variable for every data point listed below.

Variable Value
date Monday 2019-03-18
time 10:05:34 AM
average_astronaut_mass_kg 80.7
fuel_mass_kg 760000
ship_mass_kg 74842.31
fuel_level 100%

4.11.3. Collect User Input

Prompt the user to enter for the following information, and store each response in its own variable:

  1. The number of astronauts in the crew (1 - 7).
  2. The crew status (Ready or Not Ready).

4.11.4. Mass Calculations

Create variables to store the following values:

  1. The total mass of the crew (number of astronauts * average astronaut mass).
  2. The total mass of the ship (mass of crew + mass of ship + mass of fuel).


Remember to let your code do the calculations! Do NOT hard-code a number for either mass value.

For example, if you try to use total_crew_mass = 242.1, then your program works correctly ONLY IF the user enters 3 for the number of astronauts.

4.11.5. Generate the Checklist

Display the checklist in the console using your variables.

The generated report should look like the example below—including spaces and symbols (-, >, and *). Example Output

Note that your output will change if you assign different values to the variables, or if the user enters different values when prompted.

The point is to AVOID coding specific values into the print statements. Use your variable names instead!

Date: Thursday 2021-03-18
Time: 10:05:34 AM

* Crew: 7
* Crew Status: Ready
* Fuel Level: 100%

* Crew: 564.9 kg
* Fuel: 760000 kg
* Spaceship: 74842.31 kg
* Total mass: 835407.21 kg

4.11.6. Show Off Your Code

When finished, demonstrate your program to your teacher so they can verify your work.