Let us first define the function and try to know why function is being used in Python. Consider this code :
<code>
#!/usr/bin/python3
def main():
print("This is main function.")
if __name__ == "__main__":
main()
</code>
And the output is:
<blockquote>
This is main function.
</blockquote>
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 ...