Q. What is the output of the following piece of code?
#mod1
def change(a):
b = [x*2 for x in a]
print (b)
#mod2
def change(a):
b = [x*x for x in a]
print (b)
from mod1 import change
from mod2 import change
#main
s = [1,2,3]
change(s)
Answer :-
There is a name-clash. A name clash is a situation when two different entities with the same name become part of the same scope. Since both the modules have the same function name, there is a name clash, which is an error.
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )