0

python return statement

def print_nums(x): for i in range(x): print(i) return print_nums(10) in this code : i dont understand why does the output =0

21st Aug 2020, 11:31 PM
Ahmed Tarek
Ahmed Tarek - avatar
1 Antwort
+ 6
return stops the further execution of function and so only 0 is printed Also you have posted the question twice,kindky delete the previous one
21st Aug 2020, 11:36 PM
Abhay
Abhay - avatar