You execute the following command in the terminal.
python index.py Hello
You want the command to print out Hello.
What has to be inside of index.py?
You execute the following command in the terminal.
python index.py Hello
You want the command to print out Hello.
What has to be inside of index.py?
from sys import argv print(argv[1])
The answer is A because all other arguments don't exist. First, you have to import Python system. This allows your system to interact with Python. So second argv stands for argument vector. Within the argument vector, there are two lists: 1st is argv[0], which is the name of your file. Second argv[1] is the argument "Hello".