+ 1
Can there be a situation we can write a class and a function within it then call the function
python class
7 odpowiedzi
+ 5
class test:
def test_func():
print('test')
test.test_func()
# or
class test:
def test_func(self):
print('test')
obj = test()
obj.test_func()
+ 5
have a look at @Neet s prog. even if it has little prob, it shows well.
simply put fun into a class.
not too complicated
+ 4
yes... you describe recursion
+ 2
it means we can define variables in that function then call it at the console to perform back operation.right?
+ 2
Maybe the answer ist in this code?
https://code.sololearn.com/cpD1FbHOaqS8/?ref=app
+ 1
can you plz write a simple code to back up your answer