Courseiva
Computer Programming and Python FundamentalsmediumDrag & DropObjective-mapped

PCEP Computer Programming and Python Fundamentals Practice Question

Arrange the steps to write and run a Python script from the command line in the correct order.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4
5Step 5

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Write the script in a text editor, save the file with a .py extension, open a terminal or command prompt, navigate to the directory containing the script, run the script using the Python interpreter.

The process involves creating the script, saving it, opening a terminal, navigating to its location, and executing it with the Python interpreter.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Write the script in a text editor, save the file with a .py extension, open a terminal or command prompt, navigate to the directory containing the script, run the script using the Python interpreter.

    Why this is correct

    This is the correct order because you must first create and save the script, then access the command line, change to the script's directory, and finally execute it with the Python interpreter.

  • Write the script in a text editor, save the file with a .py extension, open a terminal or command prompt, run the script using the Python interpreter.

    Why it's wrong here

    This is incorrect because you must navigate to the directory containing the script before running it; otherwise, the command line will not find the script file unless it is in the current directory or the full path is provided.

  • Write the script in a text editor, open a terminal or command prompt, run the script using the Python interpreter, save the file with a .py extension.

    Why it's wrong here

    This is incorrect because you cannot run a script that hasn't been saved yet; the file must exist before the interpreter can execute it.

  • Write the script in a text editor, open a terminal or command prompt, navigate to the directory containing the script, run the script using the Python interpreter.

    Why it's wrong here

    This is incorrect because you must save the script file before running it; otherwise, the interpreter has no file to execute, and the code is not persisted.

About these practice questions

One of 498 original PCEP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This PCEP practice question is part of Courseiva's free Python Institute certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCEP exam.