The reason D is the answer because the num variable has no scope within the function. num = num + 3 as we see here is created inside the function. So when we run it, the program doesn't know which num variable to use. so, it would be help full if we type the following:
num =1
def func():
global num
num = num +3
print(num)
func()
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Knight82
4 days, 9 hours ago