A function is a block of code which is executed only when it is called. To define a Python function, the def keyword is used.
Example:
def hello(): print("Hello World!") hello() # calling the function # Output: "Hello World!"
424 questions
364 answers
99 comments
665 users