mardi 21 juillet 2020

is there any function to replace the y = z , as it was a global function

https://www.codewars.com/kata/541c8630095125aba6000c00/train/python

here i want to solve this question

def div(n):
    a = list(map(int, ' '.join(str(n)).split()))
    z = 0
    for i in a:
        z = z + i

    if z > 10:
        return globals(y) == z

    else:
        return z
y = 12345
print(div(y))

Aucun commentaire:

Enregistrer un commentaire