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

whats difference python def and class

30th Oct 2018, 9:17 PM
kokito
2 Answers
+ 7
Def defines functions. Which you can think of as like pushing a button. Whether that's printing something, editing data, generating things, etc.. Class is has more to do with data related to objects. Like enemies in a video game. It can be a monster with a health of 3 and mommy issues. Err...
30th Oct 2018, 11:07 PM
Ahri Fox
Ahri Fox - avatar
+ 3
def its used for define functions while class for define classes
30th Oct 2018, 9:49 PM
KrOW
KrOW - avatar