Functions or methods are a set of tasks that you want to perform. In Python, you can define a function or a method with a keyword, def.
For instance:
def add(a,b):
return a+b
add(10,20)#calling the user-defined function
Output:
30
In the above example, I have created a user-defined function named add, and in that method, I have passed two arguments or parameters. The task that I have defined inside the add method is a+b. So, whenever I pass two arguments inside the function, it will perform the task, a+b. Thus, you can see that the output is 30 as I have passed ‘a’ as ‘10’ and ‘b’ as ‘20.’
If you are looking for an online course to learn Python, check out this Python Course by Intellipaat.