Skip to the content

Last name first

Problem

On the roll call the names go the other way around: the last name, a comma, a space and the first name. Write a function that takes the first name and the last name separately —sometimes with extra spaces on the sides— and returns the roll call line: with " Ann " and "Smith" you return "Smith, Ann". Upper and lower case stay as they arrived.

Examples

  • "Ann", "Smith" → "Smith, Ann"

  • " Peter ", "Brown" → "Brown, Peter"

  • "Grace", " Miller " → "Miller, Grace"

Besides these, the challenge has hidden tests that are revealed when you submit your solution.

You start with this

Python

def roll_call(name, surname):
    pass

JavaScript

function rollCall(name, surname) {
}
Solve this challenge

It opens in your browser, with the editor and the tests. It is free and you do not need an account to start.

More O(1) challenges

See all challenges →