class and methods | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

class and methods

hi how can i use a method in another method in one class for example class student(): def plus(self,A,B): def a(self): i want to use def plus in this method

10th Jun 2020, 12:52 PM
nima rasi
5 Answers
+ 3
class student(): def plus(self): print("plus activated") def a(self): self.plus() test = student() test.a()
10th Jun 2020, 12:58 PM
Russ
Russ - avatar
+ 2
Just call self.plus() in the a() method.
10th Jun 2020, 12:53 PM
Russ
Russ - avatar
0
can u write code of this @Russ
10th Jun 2020, 12:56 PM
nima rasi
0
I have changed the def plus
10th Jun 2020, 12:57 PM
nima rasi
0
Thanks @Russ it works
10th Jun 2020, 1:11 PM
nima rasi