+ 1
Why is the fuction returning a 0 and None instead of the numbers within the range.
>>> def print_nums(x): for i in range(10): print(i) return >>> print(print_nums(4)) 0 None
2 Respuestas
+ 12
It will print 0 because of the for loop. then, the execution will immediately stop because of return.
And the function is returning nothing. And you are trying to print nothing. Because of this, None is printed.
+ 12
remove return and just use print_nums(4) not print(print_nums(4))