Hi Friends!
Python is very easy high level language and developing language.
A function is a block of organized, reusable code that is used to perform a single, related action. Functions provide better modularity for your application and a high degree of code reusing.
Python gives us many built-in functions like print(), etc. but we can also create our own functions.
We can define functions to provide the required functionality. Here are simple rules to define a function in Python.
Function blocks begin with the keyword def followed by the function name and parentheses.
Any input parameters or arguments should be placed within these parentheses. You can also define parameters inside these parentheses.
The first statement of a function can be an optional statement - the documentation string of the function.
The code block within every function starts with a colon and is indented.
The statement return exits a function, optionally passing back an expression to the caller. A return statement with no arguments is the same as return None.
What are if...else statement in Python?
Decision making is required when we want to execute a code only if a certain condition is satisfied.
The if..else statement evaluates test expression and will execute body of if only when test condition is True.
If the condition is False, body of else is executed. Indentation is used to separate the blocks.
watch the full video to understand every module discussed in the above video
Thanks!