+ 3

How would you make methods in Python?

I know what methods are and what functions are and I know how to make functions but how do you make methods.

1st Oct 2017, 2:44 PM
Bryan
Bryan - avatar
7 Answers
+ 5
Not to be overly short, but the object-oriented programming section of the tutorial covers this. Finish the tutorial and you will learn how to make methods in python. Also, methods are functions.
1st Oct 2017, 3:25 PM
Mark McGhee
Mark McGhee - avatar
+ 10
def do_nothing(): pass
1st Oct 2017, 3:15 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 5
def methodName(Params if any): body of method
1st Oct 2017, 2:52 PM
Kartikey Sahu
Kartikey Sahu - avatar
+ 4
" both of your answers are describing functions with parameters." correct, which is what you asked for. functions == methods
3rd Oct 2017, 4:33 PM
Aethenosity
+ 3
thanks guys but both of your answers are describing functions with parameters.
1st Oct 2017, 3:01 PM
Bryan
Bryan - avatar