Python-Programming-Lesson-Notes

8.1 Combining Strings

“Adding” two strings produces their concatenation: 'a' + 'b' is 'ab'. Write a function called fence that takes two parameters called original and wrapper and returns a new string that has the wrapper character at the beginning and end of the original. A call to your function should look like this:

print(fence('name', '*'))
*name*
Solution
def fence(original, wrapper):
  return wrapper + original + wrapper

Episode 8 exercise 2