Custom Function in Python

Custom Function in Python

 

Custom Function in Python, In this article i will create a simple Python function using Python.

Function in Python

  1. Function is created to hold specific function to execute a specific task when call
  2. Use the “def” key work , to create a new function
  3. To create a function you need an indentation of 4 spacing

 

>>> def calculate_age(year):
...     age =2018-year                                   
...     return age      

Calling the function

>>> calculate_age(2000)
18                                                       
>>>     

Check out List and Dictionaries in Python here

Leave a Reply

Your email address will not be published. Required fields are marked *

five × two =