Well let's break it down,
return sum([int(x) for x in str(a)])
The first part of this function is the fact we are using list comprehension to generate a list.
[int(x) for x in str(a)]
Let's rename it to what it is working on
[int(digit) for digit in str(number)]
When we convert the number into a string it will be able to iterate over every digit of the number. Then we convert every digit back to an itn type when it gets placed back into the list.
After it generates the list we use the built-in function
sum() to calculate the sum of all the digits in the list and return that.
It may look like gibberish but list comprehension is one of the most useful things to get line count down and it can be tons faster than loops because it is automagically converted into byte-code which runs way faster.