Python_Institute
PCEP-30-02 · Question #144
PCEP-30-02 Question #144: Real Exam Question with Answer & Explanation
Sign in or unlock PCEP-30-02 to reveal the answer and full explanation for question #144. The question stem and answer options stay visible for context.
Question
You have the following le.
index.py:
from sys import argv\nsum = 0\nfor i in range(2, len(argv)):\n sum += float(argv[i])\nprint(\n "The average score for {0} is {1:.2f}"\n .format(argv[1], sum/(len(argv)-2))\n)\nYou want the following output: The average score for Peter is 200.00. Which command do you have to execute in the command line?
Options
- Apython index.py Peter 100
- Bpython index.py Peter 100 200 300
- CThe code is erroneous.
- Dpython index.py Peter 100 200
Unlock PCEP-30-02 to see the answer
You've previewed enough free PCEP-30-02 questions. Unlock PCEP-30-02 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.