DEV Community

Discussion on: Daily Challenge #1 - String Peeler

Collapse
 
georgeoffley profile image
George Offley • Edited

Off the top of the head in Python 🐍🐍🐍🐍

def strip_first_last(string):
     if len(string) > 2:
          return string[1:-1]
     else:
          return None

print(strip_first_last("Hello World"))