674 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.1k
1.1k views
2 2 votes
1 answers 1 answer
979
979 views
askpython asked Jul 11, 2019
979 views
1 1 vote
1 1 answer
873
873 views
1 1 vote
1 1 answer
5.4k
5.4k views
0 0 votes
1 1 answer
654
654 views
tofighi asked Jul 9, 2019
654 views