QUESTION IMAGE
Question
question: 8
what will be the output of the following program?
name = \tracy\
def print_hello(name):
name = \turtle\
print(\hello \ + name)
print_hello(name)
tracy
hello turtle
turtle
hello tracy
Step1: Analyze the function call
The function print_hello is called with the argument name (which has the value "Tracy"). Inside the function, the local variable name is reassigned to "Turtle".
Step2: Analyze the print statement
The print statement inside the function uses the local variable name (now "Turtle") and prints "hello " + "Turtle".
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
hello Turtle