← Back to course
Code Crew G6+ / Week 07 / Crew Quest
6/6
Week 07 Β· The standard library

Crew Quest

Crew Quest: Mission name maker
// random and datetime
⏱ about 30 min

Saturday: Crew Quest: Mission name maker

Every new mission needs a name, and the crew has run out of ideas. The last three missions were all called Mission Mission.

"Let the computer pick," Rocket says. "Two lists of words, one random choice from each, and a launch date for fun."

Raven writes two columns of words on the whiteboard: describing words and space words. "What do you notice?" she asks. "Five words in each column makes twenty-five possible names."

Nova sparkles as random names flash across her display. "I found a pattern," she says. "More words in each list means many more names. Try adding just one and see how the total grows."

Rocket adds a sixth word to each column and starts multiplying.

  1. The standard library comes with Python. Import what you need.
  2. random.randint(a, b) includes both ends. random.choice picks from a list. random.shuffle mixes a list.
  3. A seed makes random repeat the same sequence, which helps testing.
  4. A tuple keeps values together in round brackets.
  5. from datetime import date. Subtract dates to get the days between them.
# mission_name.py
import random

first = ["Bright", "Silent", "Swift", "Golden", "Hidden"]
second = ["Comet", "Orbit", "Nebula", "Horizon", "Aurora"]

name = random.choice(first) + " " + random.choice(second)
print("Your mission:", name)
print("Possible names:", len(first) * len(second))
Each list has 5 words. If you add one word to each list, how many possible names are there?
WHY THIS EXERCISESix choices for the first word and six for the second make 6 times 6, which is 36 names.
β—‡ NAME THE NEXT MISSION
With a grown-up, add your own words to both lists. Keep them friendly and space themed.
Run mission_name.py five times and write down your favorite names.
Pick the winner together. Then use days_until.py to count the days to a pretend launch date.
MORE REVIEW: WEEK 7
  • Read the question.
  • Tap your answer.
Which numbers can random.randint(3, 5) give?
What does (date(2026, 6, 10) - date(2026, 6, 3)).days give?
Which tool mixes a list into a random order?

Great work. Next week your programs will save information in files, so it is still there after the program ends.

← Friday