← Back to course
Code Crew G4 / Week 06 / Crew Quest
6/6
Week 06 Β· Split and join

Crew Quest

Crew Quest: Secret Log
// Decode the comms log
⏱ about 15 min

Crew Quest: Secret Log

Rocket and Raven want to send secret notes to each other across the station. Rocket writes a log line that looks ordinary but hides a word.

"Happy oats pods eat," he reads. Raven laughs. "That makes no sense! What do you notice about the first letters?" She spells them out: H, O, P, E. "Hope!"

Nova twirls. "Hidden in plain sight," she says. "Now it is your turn to hide one."

  1. split(",") cuts a string at every comma and makes a list of strings.
  2. split() with empty brackets cuts at spaces.
  3. join glues a list of strings into one string: ", ".join(crew).
  4. Split first, then use an index to read one piece of a log entry.
  5. Split, loop and join together can decode a message.
β—‡ SECRET LOG
Pick a secret word with four or five letters.
Write a silly sentence where each word starts with the next letter.
Give it to your partner. They write the first letters in a column.
Can they decode it? Then swap jobs.
log = "nice orbits very awesome"
letters = []
for w in log.split():
    letters.append(w[0])
print("".join(letters))
What hidden word does the program show?
WHY THIS EXERCISEThis checks split, the loop and join all together.
BONUS RECAP
  • Read the question.
  • Tap your answer.
How many items does "a,b".split(",") give?
What does "+".join(["1", "2"]) give?
split() with empty brackets cuts at what?

Wonderful decoding! Next week, you will meet dictionaries.

← Friday