Given a number, return a string with dash``` '-' ```marks before and after each odd integer,  but do not begin or end the string with a dash mark.

Ex:

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Data structures

Starter code: def dashatize(num):
	

Solutions:
import re

def dashatize(num):
	try:
		return ''.join(['-' + i + '-' if int(i) % 2 else i for i in str(abs(num))]).replace('--', '-').strip('-')
	except:
		return 'None'


import re

def dashatize(num):
	return 'None' if num is None else '-'.join((w for w in re.split('([13579])', str(abs(num))) if len(w) > 0))


def dashatize(num):
	num_str = str(num)
	for i in ['1', '3', '5', '7', '9']:
		num_str = num_str.replace(i, '-' + i + '-')
	return num_str.strip('-').replace('--', '-')


from re import findall

def dashatize(num):
	return '-'.join(findall('([13579]|[02468]+)', str(num))) or 'None'


def dashatize(num):
	array = []
	if num == None:
		return 'None'
	elif num == 0:
		return '0'
	elif num == -1:
		return '1'
	num = str(num).replace('-', '')
	for i in str(num):
		if int(i) % 2 == 0:
			array.append(i)
		else:
			array.append('-' + i + '-')
	string = ''.join(array)
	if string[0] == '-' and string[-1] == '-':
		string = string[1:-1]
	if string[0] == '-':
		string = string[1:]
	if string[-1] == '-':
		string = string[:-1]
	result = string.replace('--', '-')
	return result


import re

def dashatize(num):
	lst = re.findall('[13579]|[02468]+', str(num))
	return '-'.join(lst) if lst else 'None'


import re

def dashatize(num):
	if num == None:
		return 'None'
	if num < 0:
		num = num * -1
	return '-'.join(list(filter(None, re.split('(1|3|5|7|9)', str(num)))))


def dashatize(n):
	if n == None:
		return 'None'
	s = ''
	n_s = str(n).strip('-')
	for c in n_s:
		if int(c) % 2 == 0:
			s += c
		else:
			s += '-' + c + '-'
	return s.replace('--', '-').strip('-')


import re

def dashatize(num):
	p = re.compile('([13579])')
	return p.sub('-\\1-', str(num)).replace('--', '-').strip('-')


def dashatize(num):
	if type(num) != int:
		return 'None'
	a = ['-{}-'.format(x) if int(x) % 2 != 0 else '{}'.format(x) for x in list(str(num).strip('-'))]
	return ''.join(a).strip('-').replace('--', '-')