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!"
423 questions
363 answers
99 comments
552 users