+ 1

what are def and how to use it?

also a little about class would also be appreciated.

3rd Dec 2016, 6:00 PM
Sanju
Sanju - avatar
2 Antworten
+ 2
"def" is used to define functions. Using this you can make your own functions with your own conditions. For example: def my_func(): print("Hello world!") Now that I've defined a function above, I can execute it whenever I like: print(my_func()) Output: Hello world! Hope this helped!
3rd Dec 2016, 6:11 PM
Zahin Zaman
Zahin Zaman - avatar
+ 1
def is a keyword to define functions and class keyword is to define a class object def function_name(): ## code goes here class ClassName(object): ## Code goes here
3rd Dec 2016, 6:09 PM
Nedim Kanat
Nedim Kanat - avatar