Quiz Question 1 of 5
What will be the result of running the following code if num
is defined outside the functions, and both functions modify and print num
?
def increment_num():
global num
num += 1
print("Incremented num:", num)
def square_num():
global num
num = num * num
print("Squared num:", num)
num = 2
increment_num()
square_num()
Choose the correct answer below: