```if-not:javascript,python
Write function `parseFloat` which takes an input and returns a number or `Nothing` if conversion is not possible.
```

```if:python
Write function `parse_float` which takes a string/list and returns a number or 'none' if conversion is not possible.
```

```if:javascript
Write function `parseF` which takes an input and returns a number or null if conversion is not possible. The input can be one of many different types so be aware.
```

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def parse_float(string):
	

Solutions:
def parse_float(string):
	try:
		return float(string)
	except:
		return None


def parse_float(string):
	try:
		return float(string)
	except (ValueError, TypeError):
		return None


def parse_float(string):
	try:
		return float(string)
	except:
		pass


def parse_float(s):
	try:
		return float(s)
	except:
		pass


def parse_float(s):
	if type(s) == str and __import__('re').match('[\\d\\.]+', s):
		return float(s)


def parse_float(s):
	try:
		return float(s)
	except (ValueError, TypeError):
		return None


def parse_float(string):
	return float(string) if type(string) is str and '.' in string else None


parse_float = lambda x, y=exec('def f(s):\n try:\n  return float(s)\n except:  return None'): f(x)


def parse_float(string):
	for char in string:
		if not char.isnumeric() and char != '.':
			return None
	if '.' in string:
		return float(string)
	return None


def parse_float(string):
	if isinstance(string, str):
		stringList = string.split('.')
		if len(stringList) == 2 and all((x.isdigit for x in stringList)):
			return float(stringList[0] + '.' + stringList[1])
		else:
			return None
	else:
		return None


def parse_float(string):
	return float(string) if str(string).replace('-', '').replace('.', '').isdecimal() else None


def parse_float(string):
	return float(string) if isinstance(string, str) and (not string.isalnum()) else None


from re import findall

def parse_float(string):
	if isinstance(string, str) and findall('[-+]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][-+]?\\d+)?', string):
		return float(string)


def parse_float(str):
	try:
		return float(str)
	except (TypeError, ValueError):
		return


import re

def parse_float(string):
	return float(string) if type(string) == str and re.match('\\d+\\.\\d+$', string) else None


def parse_float(original):
	string = ''.join(original)
	try:
		return float(string)
	except:
		return None


def parse_float(string):
	string = str(string)
	try:
		float(string)
		return float(string)
	except ValueError:
		return None


def parse_float(string):
	try:
		return float(string)
	except ValueError:
		return None

def parse_float(string):
	try:
		(whole, fractional) = string.split('.', maxsplit=1)
	except:
		return None
	if not all((d.isdigit() for d in whole)) or not all((d.isdigit() for d in fractional)):
		return None
	whole = sum((int(val) * 10 ** place for (place, val) in enumerate(whole[::-1])))
	fractional = sum((int(val) * 10 ** (-(place + 1)) for (place, val) in enumerate(fractional)))
	return whole + fractional


def parse_float(n):
	try:
		if float(n):
			return float(n)
	except:
		return None


def parse_float(string: str) -> float:
	if type(string) == list:
		return None
	try:
		return float(string)
	except ValueError:
		return None


def parse_float(string):
	try:
		if type(string) == list:
			for i in range(len(string)):
				string[i] = float(string[i])
			return string
		return float(string)
	except ValueError:
		return None


def parse_float(string):
	try:
		float(string)
		if True:
			return float(string)
	except:
		return None


def parse_float(string):
	print(string)
	return None if type(string) == list else float(string) if '.' in string else None


def parse_float(string):
	try:
		num = float(string)
		return num
	except:
		return


def parse_float(string):
	try:
		if float(string) > 0 or float(string) < 0:
			return float(string)
	except:
		return None


def parse_float(string):
	return float(''.join(string)) if ''.join(''.join(string).split('.')).isdigit() else None


def parse_float(string):
	if isinstance(string, str):
		if string.isalpha():
			return None
		return float(string)


def parse_float(string):
	if type(string) == str:
		split_string = string.split('.')
		new_string = ''.join(split_string)
		if new_string.isdigit():
			return float(string)
		else:
			return None
	elif type(string) == list:
		new_list = ''.join(string)
		if new_list.isdigit():
			return float(string)
		else:
			return None
	else:
		pass


def parse_float(string):
	if isinstance(string, str):
		return float(string) if string.replace('.', '', 1).isdigit() else None
	else:
		return None


def parse_float(string):
	x = [string]
	for item in x:
		try:
			return float(item)
		except:
			return


def parse_float(string):
	if type(string) == list:
		separator = ','
		new_string = separator.join(string)
		string = new_string
	try:
		to_int = float(string)
		return to_int
	except ValueError:
		return None


def parse_float(string):
	try:
		x = float(string)
		return x
	except ValueError:
		return None
	except TypeError:
		try:
			y = float(''.join(string))
			return y
		except ValueError:
			return None


def parse_float(string):
	return None if any((i.isalpha() for i in string)) else float(string)


import re

def parse_float(string):
	if not isinstance(string, str):
		return None
	res = re.match('[0-9.]+', string)
	return float(res.group()) if res else None


def parse_float(st):
	for i in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ':
		if i in st or type(st) == list:
			return None
		else:
			return float(st)


def parse_float(string):
	flag = False
	for ch in string:
		if ord(ch) >= ord('0') and ord(ch) <= ord('9') or ord(ch) == ord('.'):
			flag = True
		else:
			flag = False
			break
	if flag:
		return float(''.join(string))
	else:
		return None


def parse_float(string):
	if type(string) == list:
		return None
	if string.isalpha():
		return None
	if float(string):
		return float(string)
	return -1


def parse_float(string):
	for i in ''.join(string):
		if i in 'abcdefghijklmnopqrstuvwxyz':
			return None
	return float(''.join(string))


def parse_float(string):
	try:
		a = eval(string)
	except:
		a = None
	return a


parse_float = lambda string: None if not all((c.isdigit() or c == '.' for c in string)) else float(string)


def parse_float(x):
	try:
		return float(x)
	except:
		return None


def parse_float(string):
	for i in string:
		if i not in '0.123456789':
			return None
	return float(string)


def parse_float(string):
	try:
		if type(string) is list:
			return float(''.join(string))
		else:
			return float(string)
	except ValueError:
		return None


def parse_float(ts):
	try:
		float(ts)
		return float(ts)
	except:
		return None


def parse_float(string):
	return float(string) if type(string) == str and string.replace('.', '').replace('-', '').isdigit() else None


def parse_float(string):
	for e in string:
		c = ord(e)
		if c == 46 or (c > 47 and c < 58):
			pass
		else:
			return None
	return float(string)


def parse_float(string):
	string = ''.join(string)
	if string.replace('.', '').isdigit():
		return float(string)
	return None


def parse_float(string):
	try:
		return float(string)
	except:
		print(EnvironmentError)


def parse_float(string):
	if not all((c.isdigit() or c == '.' for c in string)):
		return None
	if not '.' in string:
		return int(string)
	return float(string)


def parse_float(string):
	if type(string) == str:
		return None if string.isalpha() else float(string)
	else:
		set = ''
		num = set.join(string)
		return None if not num.isnumeric() else num


from operator import methodcaller

def parse_float(string):
	if isinstance(string, list):
		string = ''.join(string)
	p = NumParser(string)
	res = p.parse_float()
	p.eof()
	if p.failed:
		return None
	return res

class Parser(object):

	def __init__(self, string):
		self.string = string
		self.failed = False

	def __repr__(self):
		return f'{self.__class__.__name__}({self.string}, {self.failed})'

	def look(self):
		return type(self)(self.string)

	def get(self):
		if len(self.string) == 0 or self.failed:
			self.failed = True
			return None
		char = self.string[0]
		self.string = self.string[1:]
		return char

	def eof(self):
		if self.failed:
			return None
		self.failed = len(self.string) > 0

	def satisfy(self, func):
		char = self.get()
		if self.failed:
			return None
		res = func(char)
		if isinstance(res, bool) and res:
			return char
		self.string = char + self.string
		self.failed = True
		return None

	def option(self, default, methodname, *args, **kwargs):
		looker = self.look()
		func = methodcaller(methodname, *args, **kwargs)
		func(looker)
		if looker.failed:
			return default
		return func(self)

	def char(self, character, insensitive=False):
		if insensitive:
			return self.satisfy(lambda x: x.casefold() == character.casefold())
		return self.satisfy(character.__eq__)

	def many(self, methodname, *args, **kwargs):
		func = methodcaller(methodname, *args, **kwargs)
		results = []
		while not self.failed:
			res = func(self)
			if self.failed:
				self.failed = False
				break
			results.append(res)
		return results

	def many1(self, methodname, *args, **kwargs):
		func = methodcaller(methodname, *args, **kwargs)
		res = func(self)
		if self.failed:
			return None
		results = [res]
		results.extend(self.many(methodname, *args, **kwargs))
		return results

class NumParser(Parser):

	def parse_int(self, signed=True):
		sign = -1 if signed and self.option('+', 'char', '-') == '-' else 1
		digits = self.many1('satisfy', str.isdigit)
		if self.failed:
			return None
		return sign * int(''.join(digits))

	def parse_float(self):
		intpart = self.parse_int()
		if self.failed:
			return None
		sign = -1 if intpart < 0 else 1
		self.option(None, 'char', '.')
		floatpart = self.option(['0'], 'many1', 'satisfy', str.isdigit)
		floatpart = int(''.join(floatpart)) / 10 ** len(floatpart)
		if self.option(None, 'char', 'e', insensitive=True) is not None:
			exppart = self.parse_int()
		else:
			exppart = 0
		if self.failed:
			return None
		return (intpart + sign * floatpart) * 10 ** exppart


def parse_float(string):
	string_new = ''.join(string)
	try:
		float(string_new)
	except ValueError:
		return None
	return float(string_new)
	pass


def parse_float(string):
	if type(string) == list:
		try:
			return [float(i) for i in string]
		except ValueError:
			return None
	else:
		try:
			return float(string)
		except ValueError:
			return None


def parse_float(string):
	string = ''.join(string)
	while True:
		try:
			return float(string)
		except ValueError:
			return None


def parse_float(string):
	try:
		return float(string)
	except ValueError as ex:
		return None
	except TypeError as xe:
		return None


def parse_float(string):
	lst = []
	if type(lst) == type(string):
		return None
	elif 'a' <= string[0] >= 'z' or 'A' <= string[0] >= 'A':
		return None
	else:
		return float(string)


def parse_float(string):
	print(string)
	try:
		return float(string)
	except TypeError:
		return None if None in [parse_float(x) for x in string] else [parse_float(x) for x in string]
	except ValueError:
		return None


def parse_float(string):
	return None if len([c for c in string if c not in '.0123456789']) else float(string)


def parse_float(string):
	arr = []
	if isinstance(string, list):
		for x in string:
			try:
				arr.append(float(x))
			except ValueError:
				return None
		return arr
	try:
		return float(string)
	except ValueError:
		return None


def parse_float(string):
	if type(string) == list:
		string = ''.join([ele for ele in string])
	try:
		return float(string)
	except ValueError:
		return None


def parse_float(string):
	if type(string) == list:
		for i in string:
			string = ''.join(string)
	try:
		return float(string)
	except ValueError or TypeError:
		return None


def parse_float(string):
	for i in string:
		if i.isdigit() and type(string) is not list:
			return float(string)
		else:
			return None


def parse_float(string):
	try:
		result = float(string)
	except:
		return None
	else:
		return result


def parse_float(string):
	string = ''.join((i for i in string))
	try:
		string = float(string)
		return string
	except ValueError:
		return None


def parse_float(string):
	try:
		f = float(string) if isinstance(string, str) else float(''.join(string))
		return f
	except ValueError:
		return None


def parse_float(string):
	try:
		return None if not string.replace('.', '').isdigit() else float(string)
	except:
		return None


def parse_float(value):
	try:
		float(value)
		return float(value)
	except:
		return None
parse_float('1')


def parse_float(string):
	if isinstance(string, list):
		string = ''.join(string)
	try:
		return float(string)
	except ValueError:
		return None


def parse_float(string):
	if isinstance(string, list) or string.isalpha():
		return None
	return float(string)


def parse_float(string):
	try:
		if type(string) == list:
			return None
		else:
			floated_string = float(string)
			return floated_string
	except ValueError:
		return None


def parse_float(string):
	stuff = []
	blah = ''
	for i in string:
		if i in '0123456789.':
			stuff.append(i)
			blah = ''.join(stuff)
		else:
			return None
	return float(blah)