[Solved] What is the process of this program written in Python?


It seems you are new to the world of programming.
“sys.argv” is used to take Command Line Arguments.

  • when you run as “python sample.py”, the variable sys.argv will be a single element list i.e. [“sample.py”]
  • len(sys.argv) is 1 in this case

The Expected Working of the program is:

  • when you run as “python sample.py fileToRead.txt”, the variable sys.argv will be a two element list i.e. [“sample.py”,”fileToRead.txt”]
  • len(sys.argv) is 2 in this case

1

solved What is the process of this program written in Python?