PCEP-30-02 Exam QuestionsBrowse all questions from this exam

PCEP-30-02 Exam - Question 162


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?

Show Answer
Correct Answer:

Discussion

2 comments
Sign in to comment
akumoOption: A
Mar 20, 2025

from sys import argv print(argv[1])

Knight82Option: A
Apr 27, 2025

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".