본문 바로가기
나는 이렇게 학습한다/Algorithm & SQL

1221. Name Shuffler

by daco2020 2022. 12. 21.

Write a function that returns a string in which firstname is swapped with last name.

Example(Input --> Output)

"john McClane" --> "McClane john"



Solution:

def name_shuffler(str_):
    return " ".join(str_.split(" ")[::-1])