Reverse and invert all integer values in a given list. 

Python:

    reverse_invert([1,12,'a',3.4,87,99.9,-42,50,5.6]) = [-1,-21,-78,24,-5]
    
Ignore all other types than integer.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def reverse_invert(lst):
	

Solutions:
from math import copysign as sign

def reverse_invert(lst):
	return [-int(sign(int(str(abs(x))[::-1]), x)) for x in lst if isinstance(x, int)]


def reverse_invert(lst):
	return [(-1, 1)[x < 0] * int(str(abs(x))[::-1]) for x in lst if isinstance(x, int)]


reverse_invert = lambda l: [(-1 if n > 0 else 1) * int(str(abs(n))[::-1]) for n in l if type(n) == int]


def reverse_invert(lst):
	r = []
	for i in lst:
		if isinstance(i, int):
			if i < 0:
				i = int(str(i)[1:][::-1])
			else:
				i = -int(str(i)[::-1])
			r.append(i)
	return r


def reverse_invert(lst):
	return [(-1) ** (n > 0) * int(str(abs(n))[::-1]) for n in lst if type(n) == int]


def reverse_invert(lst):
	return [int(str(x).lstrip('-')[::-1]) * (1 if x < 0 else -1) for x in lst if isinstance(x, int)]


def reverse_invert(lst):
	return [-1 * int(str(i)[::-1]) if i >= 0 else int(str(i)[1:][::-1]) for i in lst if type(i) == int]


def reverse_invert(lst):
	step1 = [str(-1 * int(str(n)))[::-1] for n in lst if type(n) == int]
	step2 = [int(x) if '-' not in x else -1 * int(x.replace('-', '')) for x in step1]
	return step2