In arguments give list of int. You need return 1 digit which will be sum of digits list's mean.
[3, 7] -> 5 (list's mean)
[523, 687, 953] -> 721 (list's mean) -> 10 (sum of digits) -> 1 (sum of digits)
def mean_sum(nums):
return mean_sum(round(sum(nums)/len(nums))) if isinstance(nums, list) else nums if nums < 10 and nums > -10 else mean_sum(sum(int(i) for i in str(nums)))
import codewars_test as test
from solution import mean_sum
# test.assert_equals(actual, expected, [optional] message)
@test.describe("Static tests")
def test_static():
@test.it("basics")
def test_base():
test.assert_equals(mean_sum([3, 7]), 5, 'You don\'t complete basic tests')
test.assert_equals(mean_sum([98, 1000, 2]), 7, 'You don\'t complete basic tests')
test.assert_equals(mean_sum([523, 687, 953]), 1, 'You don\'t complete basic tests')