QUESTION IMAGE
Question
question: 3
what will be printed when the program below is run?
def add_two(x):
return x + 2
def multiply_by_three(x):
return x * 3
def my_function(x):
return add_two(x) + multiply_by_three(x)
print(my_function(12))
12
24
50
66
Step1: Calculate add_two(12)
$add\_two(12)=12 + 2=14$
Step2: Calculate multiply_by_three(12)
$multiply\_by\_three(12)=12\times3 = 36$
Step3: Calculate my_function(12)
$my\_function(12)=add\_two(12)+multiply\_by\_three(12)=14 + 36=50$
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
50