← Back to challenges

Concatenating First and Last Character of a String

PythonMediumstringslanguage_fundamentals

Instructions

Create a function that takes a string and returns the concatenated first and last character.

Examples

first_last("ganesh") ➞ "gh"

first_last("kali") ➞ "ki"

first_last("shiva") ➞ "sa"

first_last("vishnu") ➞ "vu"

first_last("durga") ➞ "da"

Notes

There is no empty string.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Is the String Odd or Even?