educative.io

Quiz - Learn Python from Scratch

In this quiz, Question 1, the output iis only Hello but why not !!Hello!!

Hi Jayant! The function doesn’t modify the my_string variable that was created in the global scope. For the output to be !!Hello!! the bottom block of code would have to look like this:

print(exclamation(my_string))

or

new_string = exclamation(my_string)
print(new_string)

Let me know if this helps!

4 Likes