반응형
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])
반응형
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
1223. validate code with simple regex (0) | 2022.12.23 |
---|---|
1222. Formatting decimal places #0 (0) | 2022.12.23 |
1220. The 'if' function (0) | 2022.12.20 |
1219. Return the day (0) | 2022.12.19 |
1218. Remove First and Last Character (0) | 2022.12.18 |