Python-Programming-Lesson-Notes

8.3 Selecting Characters From Strings

If the variable s refers to a string, then s[0] is the string’s first character and s[-1] is its last. Write a function called outer that returns a string made up of just the first and last characters of its input. A call to your function should look like this:

print(outer('helium'))
hm
Solution
def outer(input_string):
    return input_string[0] + input_string[-1]

Episode 8 exercise 4