Skip to content

Latest commit

 

History

History
41 lines (23 loc) · 567 Bytes

File metadata and controls

41 lines (23 loc) · 567 Bytes

CodeWars Python Solutions


Summy

Write a function that takes a string which has integers inside it separated by spaces, and your task is to convert each integer in the string into an integer and return their sum.

Example

summy("1 2 3")  ==> 6

Good luck!


Given Code

def summy(string_of_ints):
    pass

Solution

def summy(string_of_ints):
    return sum([int(i) for i in string_of_ints.split(" ")])

See on CodeWars.com