return is a construction used in the code block of a function definition + after the return instruction is inserted the code block will stop executing anything so :
def print_nums(x):
for i in range(x):
print(i)
return
print_nums(10)
Program takes 0, verifies that is in range of 10 and prints 0
Because of the return statement program stops executing the code
If return is deleted from code the output will be
0
1
2
3
4
5
6
7
8
9
That depends on the indentation:-)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
The indentation went wrong because of improper markdown
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit