Roll Call
Stardate 55104.7 ยท UES Magnanimous
Briefing
Since the last software update, the bridge roll call has greeted every officer as "None None reporting". Chief T'Kala, who is two and a half metres tall and has never once needed to raise her voice, has asked, very gently, for her name back.
The routine that assembles the greeting was written by Ensign Tannenbaum during what he describes as "a very productive night shift". It concatenates a rank and a surname. It concatenates them wrong.
Mission objectives
ARCHIE checks all five every time you run diagnostics.
- โขEnsign Tannenbaum reporting
- โขChief T'Kala reporting, apostrophe intact
- โขA one-word surname
- โขA double-barrelled Captain
- โขExactly one space between rank and surname, and one before 'reporting'
Objective
Write roll_call(rank, surname), which returns the string
"<rank> <surname> reporting". So
roll_call("Ensign", "Tannenbaum") is
"Ensign Tannenbaum reporting".
Press Run Diagnostics and I will tell you which objectives you actually met.
Objective
Write roll_call(rank: &str, surname: &str) -> String, which
returns "<rank> <surname> reporting". So
roll_call("Ensign", "Tannenbaum") is
"Ensign Tannenbaum reporting".
Press Run Diagnostics and I will tell you which objectives you actually met.
Ask Commander Raghunathan for a hint
You want a formatted string: an f-string in Python, format! in Rust. Count the spaces in the expected output; a stray one is the usual culprit.
Debrief
Roll call now reads "Chief T'Kala reporting", and the Chief has thanked you by introducing you to the plant on the bridge. The plant is called Gerald. Gerald is on the duty roster. Do not ask.