1. Python - Functions

Function Syntax

def functionname(args,args):

        do something


def functionname(arg,arg):

        do something

        return


Functions with Optional Args:

def functionname(VAR="hello"):

        print("HEY",VAR)

// calling functionname(VAR="NOTHELLO) or functionname("NOTHELLO") overrides the VAR


Docstrings // descriptions to explain function

def functionname():

    """this is a description.

    >>> test

    """

// use help(functionname) to get description


Placeholder line

def functionname():

        pass // placeholder

Comments

Popular posts from this blog

2. FreeCodeCamp - Dynamic Programming - Learn to Solve Algorithmic Problems & Coding Challenges

20. Data Analytics - Analyze Data to Answer Questions - Week 1

3. Algorithms - Selection Sort