Given a mixed array of number and string representations of integers, add up the string integers and subtract this from the total of the non-string integers. 

Return as a number.

Difficulty: introductory

Starter code:

def div_con(x):
	

Solutions:
def div_con(lst):
    return sum(n if isinstance(n, int) else -int(n) for n in lst)

def div_con(x):
    return sum([a for a in x if isinstance(a, int)]) - sum([int(a) for a in x if not isinstance(a, int)])

def div_con(x):
    integer = []
    string = []
    for element in x:
        if type(element) == int:
            integer.append(element)
        else:
            string.append(int(element))
    return sum(integer) - sum(string)

def div_con(x):
    sum = 0    
    for i in x:
        if (type(i) == int):
            sum += i
        else:
            sum -= int(i)    
    return sum

def div_con(x):
    return sum(-int(i) if isinstance(i, str) else i for i in x)

def div_con(x):

    diff = 0
    for num in x:
        if isinstance(num, int):
            diff += num
        else:
            diff -= int(num)
          
    return diff
    
            


div_con=lambda l:sum(e if type(e)==int else -int(e)for e in l)

def div_con(x):
    # your code here
    num = 0 #set the variable num = 0
    strnum = 0 #set the variable strnum = 0
    for number in x: #for an element of x
        if int(number) == number: #if the integer version of the element is equivalent to the element
            num = num + number #num is num + the number(element) of x
        else:
            strnum = strnum + int(number) #otherwise, if it's a string, add the integer value of the string
    num = num - strnum #num is the total of the integers - the total of the strings
    return num #return num

div_con=lambda x:sum(i for i in x if type(i)==int)-sum(int(s) for s in x if type(s)==str)

def div_con(x):
    # your code here
    return sum(i for i in x if isinstance(i, int)) - sum( int(i) for i in x if isinstance(i, str))