Shuffle the Name

Published by Matt in

Create a function that takes a string (will be a person's first and last name) and returns a string with the first and last name swapped.

Examples

"Donald Trump" ➞ "Trump Donald"

"Rosie O'Donnell" ➞ "O'Donnell Rosie"

"Seymour Butts" ➞ "Butts Seymour"

Notes

  • There will be exactly one space between the first and last name.
  • If you get stuck on a challenge, find help in the Resources tab.
  • If you're really stuck, unlock solutions in the Solutions tab.
Watch a quick demo on how Edabit works.