Skip to content

Latest commit

 

History

History
47 lines (25 loc) · 538 Bytes

Sum_Mixed_Array.md

File metadata and controls

47 lines (25 loc) · 538 Bytes

CodeWars Python Solutions


Sum Mixed Array

Given an array of integers as strings and numbers, return the sum of the array values as if all were numbers.

Return your answer as a number.


Given Code

def sum_mix(arr):
    #your code here

Solution 1

def sum_mix(arr):
    return sum([int(n) for n in arr])

Solution 2

def sum_mix(arr):
    return sum(map(int, arr))

See on CodeWars.com