+ 1
what are def and how to use it?
also a little about class would also be appreciated.
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!
+ 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