Program to Printing its Own Name as Output:

Suppose we want to write a program that prints its own name in python for data science. The main function will be written in the following manner.

Program to Printing its Own Name as Output in Python for Data Science

Now we should understand the arguments given in the program above.

  • The argument, argc is number of arguments pass in our program.
  • The argument argv is array for holding the names of arguments pass in our program.
  • We have an extra piece of information store in the first cell of the array.

For printing the name of the program we have to slice the filename out of the path.

Implementation:

Now we will see the implementation. Let us suppose name of the script is print_my_name.

Program to Printing its Own Name as Output in Python for Data Science

So, to learn more about it in python for data science, you can check this and this as well.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.