816 views

1 Answer

0 0 votes

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

Related questions

1 1 vote
1 1 answer
1.2k
1.2k views
2 2 votes
1 answers 1 answer
1.1k
1.1k views
askpython asked Jul 11, 2019
1,123 views
1 1 vote
1 1 answer
1.0k
1.0k views
1 1 vote
1 1 answer
5.5k
5.5k views
0 0 votes
1 1 answer
802
802 views
tofighi asked Jul 9, 2019
802 views