Functions are used to make certain portions of codes reusable and are a great tool to bring efficiency in the codes. In Python, we define a function using keyword “def” followed by the name of the function, the parameters and the indented block which will execute the function to produce a certain output. Let’s look at few examples-
Function # 1 is called “hello” and it takes no parameter and will print “This is my first python function and I’m so excited”, whenever this function is called [ hello ()]. Functions may be given parameters and default values, in case the user is not providing or overwriting the default values, the function will use these values to process the codes.
Can you figure out what the other two Python functions are doing?
Python also has a host of in built functions – Inbuilt Functions