← Back to challenges

Reverse LEGO Yoda

PythonHardstringsformatting

Instructions

Create a function that takes a string with at least one sentence in it and returns a string with the part(s) after the comma at the beginning of the sentence(s).

Examples

reverse_lego_yoda("Hit you with my stick, I shall.")
➞ "I shall hit you with my stick."

reverse_lego_yoda("Rejected me, my crush has. Ketamine, I need.")
➞ "My crush has rejected me. I need ketamine."

reverse_lego_yoda("An alien, I am. Holding me captive in Area 51, the government is.")
➞ "I am an alien. The government is holding me captive in Area 51."

Notes

  • Pay close attention to letter cases.
  • Sentences will always end with a period.
  • There will always be exactly one comma in each of the sentences.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.