How to add numbers inside a variable? [closed]

try:

sum(int(y) for y in var.split())
>> 20

Leave a Comment