Whats the difference? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Whats the difference?

Whats the difference between method and function in python? Please expain in a simplified way I am a newbie learner😊😊

19th Jun 2020, 7:21 PM
Rahi S
Rahi S - avatar
4 Réponses
+ 6
A method is a function within a class. Other than that, they are the same class Dog: def make_noise(self): print('bark!') Dog.make_noise() bark! OR def make_noise(): print('bark!') make_noise() bark!
19th Jun 2020, 7:24 PM
Slick
Slick - avatar
0
I'd say a method can be either a function or a procedure. A function returns data, whereas a procedure doesn't.
19th Jun 2020, 7:23 PM
Felipe BF
0
For slick Whats a class
19th Jun 2020, 7:26 PM
Rahi S
Rahi S - avatar
0
Whats this?
19th Jun 2020, 7:29 PM
Rahi S
Rahi S - avatar