It's pretty straightforward. Your goal is to create a function that removes the first and last characters of a string. You're given one parameter, the original string.  You don't have to worry with strings with less than two characters.

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def remove_char(s):
	

Solutions:
def remove_char(s):
	return s[1:-1]


def remove_char(s):
	return '' if len(s) <= 2 else s[1:-1]


def remove_char(s):
	return s[1:len(s) - 1]


remove_char = lambda s: s[1:-1]


def remove_char(s):
	if s == 'eloquent':
		return s[1:7]
	elif s == 'country':
		return s[1:6]
	elif s == 'person':
		return s[1:5]
	elif s == 'place':
		return s[1:4]
	elif s == 'ok':
		return ''
	else:
		return s[1:-1]


def remove_char(s):
	s = list(s)
	s.pop()
	s.pop(0)
	return ''.join(s)


def remove_char(s):
	if s is not None and len(s) > 1:
		return s[1:len(s) - 1]
	return s


def remove_char(s):
	if len(s) > 0:
		return s[1:-1]
	else:
		return ''


def remove_char(s):
	x = s[1:-1]
	return x


remove_char = lambda _: _[1:-1]


def remove_char(s):
	a = list(s)
	a.pop()
	a.reverse()
	a.pop()
	a.reverse()
	return ''.join(a)


def remove_char(s):
	return s.replace(s[0:], s[1:-1])


remove_char = lambda x: x[not ():-(not ())]


def remove_char(s):
	long = len(s)
	s = s[:0] + s[0 + 1:]
	s = s[:long - 2] + s[long - 1:]
	return s


def remove_char(s):
	return s.split()[0][1:len(s) - 1]


def remove_char(s):
	list1 = list(s)
	list1.pop(-1)
	list1.pop(0)
	return ''.join(list1)


def remove_char(s):
	l = list(s)
	del (l[0], l[len(l) - 1])
	return ''.join(l)


def remove_char(s):
	return ''.join([list(s)[i] for i in range(1, len(s) - 1)])


def remove_char(s):
	lista = list(s)
	del lista[0]
	del lista[-1]
	s = ''.join(lista)
	return s


def remove_char(s):
	l = len(s)
	v = s[1:l - 1]
	return v


def remove_char(s):
	s_neu = s[1:]
	k = s_neu[:-1]
	return k


def remove_char(s):
	s1 = []
	for x in s:
		s1.append(x)
	s1.pop(0)
	s1.pop(-1)
	s2 = ''
	for x in s1:
		s2 += x
	return s2


def remove_char(s):
	beforelastchar = len(s) - 1
	news = s[1:beforelastchar]
	return news


def remove_char(s):
	l = list(s)
	nl = [j for (i, j) in enumerate(l) if i != 0 and i != len(s) - 1]
	return ''.join(nl)


def remove_char(s):
	a = [word for word in s]
	return ''.join(a[1:-1])


def remove_char(s):
	s_list = []
	for x in s:
		s_list.append(x)
	return ''.join(s_list[1:len(s) - 1])


def remove_char(s):
	new = s[1:]
	new2 = new[:-1]
	return new2


def remove_char(s):
	b = s[1:-1]
	return str(b)