Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

question: 8 what will be the output of the following program? name = \t…

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

Explanation:

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".

Answer:

hello Turtle