Issue
I would like to print 10, but I get the error: AttributeError: 'function' object has no attribute 'x'
How to fix? Thank you
def function1():
def x():
a=10
return a
def function2():
y = function1.x()
return y
function2()
Solution
You need to return x
and call function1
as a function
def function1():
def x():
a=10
return a
return x
def function2():
y = function1()()
return y
function2()
Answered By - Samathingamajig
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.