daco2020 2023. 2. 8. 00:31

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

Return as a number.



Solution:

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