Let us first define the function and try to know why function is being used in Python. Consider this code :
print("This is main function.")
if __name__ == "__main__":
And the output is:
This is main function.
What does that mean? First of all, let us understand what function does mean. A function is used in any programming language to reuse code. Programmers are lazy and so they don't want to write again and again. And it is not a good idea to write the same thing again and again. So the concept of reusability ...