Menu

Sign in to track your progress and unlock all features.

Theme style

Log in

Full lesson preview

Concatenate Strings

Learn how to join strings by concatenation and return the combined result.

Python practice10 minVariables & Data TypesBeginnerLast updated December 29, 2025

Problem statement

Implement join_names(first, last) that returns a single string combining first and last name separated by a single space. The function should not modify the inputs aside from joining them with a space.

Task

Write a function that combines two name parts into a single string with a space between them.

Examples

Example - joining two names

Input

join_names('Ada', 'Lovelace')

Output

Ada Lovelace

Join 'Ada' and 'Lovelace' with a space between them.

Input format

Two string parameters: first and last.

Output format

A single string that is the concatenation of first, a space, then last.

Constraints

Do not add extra spaces beyond one between the names. Handle empty strings by still returning the single space when appropriate (e.g., '' + 'Smith' -> ' Smith').

Samples

Sample 1

Input

join_names('John', 'Doe')

Output

John Doe

Returns the two names joined by one space.