These multiple choice questions are for the "Creating Functions" (http://www.software-carpentry.org/v5/novice/python/02-func.html) lesson from the 'Python for Novices' course.
Consider the following code:
x=0
def add_one(x):
x=x+1
return x
add_one(1)
print "x=",x
What will be printed?
Consider the following code:
x=1
y=2
z=3
def FMA(x,y):
z=multiply(x,y)
x=x+z
return x
def multiply(x,y):
x=x*y
return x
z=FMA(1,1)
print x,y,z
What will be printed?
Explanation of answer and distractors: