나는 이렇게 학습한다/Algorithm & SQL

1221. Name Shuffler

daco2020 2022. 12. 21. 20:00
반응형

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])


반응형