0
Well, I’m doing this code that’s meant to add and print recursively.
The variable le
is the amount of times I want, which would be an accountant to at the end inform the sum of the numbers written and z
a parameter to finish recursion. Only at the end print None
.
Could someone help me, explain why this happened.
def soma(le,q=0,z=1):
h = float(input("Numero:"))
if le > z:
return soma(le, q+h, z+1)
def main():
q = soma(4)
print(q)
main()
Junior Bgdk. The question has an answer. Was it helpful to you? If you have helped you consider accepting it. Read What should I do if someone answers my question? and How and why to accept an answer?.
– Augusto Vasques