First time here? Checkout the FAQ!
x
+1 vote
298 views
asked in Python Interview Questions by (1.4k points)  
  

1 Answer

0 votes
answered by (1.4k points)  

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!"
...