V
V
Vlad Avramenko2021-10-06 21:14:56
Python
Vlad Avramenko, 2021-10-06 21:14:56

I don't understand why it doesn't return anything.

the function returns None and I don't understand why

a = input("Ведите числа: ")

def fun(a,r = 0):

    if len(a) == 1:
        print(a)
        print(type(a))
        return a

    elif len(a)> 1:
        for i in a:
            r += int(i)    
        a = str(r)
        fun(a)


print(fun(a))


Here's what it says, I don't understand the function doesn't return anything
C:\Users\Vlad>"C:\Users\Vlad\Desktop\task with OO.py" Enter
numbers: 2562563225
2
class 'str'
None

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
aleksandrssky, 2021-10-06
@krolik11zip

In the return function should be.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question