+ 1
Why is the output of following code 0 instead of no output??? the program will print all ts in x but return nothing...😥
def print_num(x): for t in range (x) : print (t) return print_num(10)
5 Respuestas
+ 3
You don't need return here. Usually functions with more than one arguments there we need return because Return statement often used to return some result, some decision making. check this example
def max(x, y):
if x >=y:
return x
else:
return y
print(max(4, 7))
z = max(8, 5)
print(z)
+ 1
Just simply remove return statement
because when function return any value it stop executing.
+ 1
You are always welcome Manish
0
yeah , I got it mate but it return nothing!!!
0
👍 thanks mate