Split a Full Name and Return Multiple Values

Easy ⏱ 8 min 77% acceptance ★★★★☆ 4.3
Implement split_name(full_name) that splits a "First Last" string on whitespace and returns the first and last name as a 2-tuple (first, last) — demonstrating Python's idiom of returning multiple values as an implicit tuple.

Examples

Example 1
Input
split_name('Ada Lovelace')
Output
('Ada', 'Lovelace')
Explanation

Split on the single space between the two words.

Constraints

  • full_name always has exactly two space-separated words.

Topics

TuplesStrings

Companies

OracleIBM

Hints

Hint 1

str.split() with no arguments splits on any whitespace.

Hint 2

Returning "first, last" implicitly builds a tuple.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.