FUNCTIONS — PYTHON
A function is a block of code which runs when it is called.You can pass data as parameters in a function.Function returns data as a a result.
1 min readJun 12, 2020
STEPS TO BE FOLLOWED WHILE WRITING A FUNCTION
- Declare the function with keyword def followed by function name
- pass the parameters inside the parentheses and end it with colon
- add the code block which is to executed
- call the function
FUNCTION DEFINITION
def requiredArg (str,num):
FUNCTION CALLING
requiredArg (“Hello”,12)
EXAMPLES:
Learning is like a ray,it has a starting point but never has an end.It is an unending journey of each and everybody’s life. Have fun coding.Have a great day. THANK YOU