892 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.3k
1.3k views
2 2 votes
1 answers 1 answer
1.2k
1.2k views
askpython asked Jul 11, 2019
1,193 views
1 1 vote
1 1 answer
1.1k
1.1k views
1 1 vote
1 1 answer
5.6k
5.6k views
0 0 votes
1 1 answer
880
880 views
tofighi asked Jul 9, 2019
880 views