Courseiva

PCEP Computer Programming and Python Fundamentals Practice Question

A programmer needs a constant that identifies the maximum number of retry attempts for a network operation. The value must not change while the program runs. Which statement about naming and using this constant in Python is accurate?

⚠ Common exam trap

The trap here is expecting Python to enforce constants through a keyword or container, when only an uppercase naming convention communicates that intent.

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

✓

Naming it MAX_RETRIES signals by convention that it should not be reassigned

Python relies on naming conventions rather than keywords to express constants, and an all-uppercase identifier such as MAX_RETRIES is the standard signal that a value is intended to remain fixed. The language does not block reassignment, so the guarantee is social and stylistic, supported by linters and code review. Placing values in functions or containers changes scope or internal mutability but never prevents rebinding the name.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Assigning it inside a function makes it permanently immutable

    Why it's wrong here

    Placement inside a function affects scope, not mutability. A local name can be rebound on any later line within that function, and once the function returns the binding disappears entirely. Immutability in Python applies to certain object types, not to where a name is defined, so this approach does not guarantee a fixed value.

  • ✓

    Naming it MAX_RETRIES signals by convention that it should not be reassigned

    Why this is correct

    Python style guidance reserves all-uppercase names with underscores for constants, communicating intent to other developers. The interpreter does not enforce this, so reassignment remains technically possible, but the naming convention is the accepted way to mark a value as fixed. Tools and reviewers rely on this signal when reading code.

  • ✗

    Wrapping the value in a tuple prevents any later change to the name

    Why it's wrong here

    A tuple is immutable, but the name bound to it can still be reassigned to a different object at any time. Storing (5,) does not lock the identifier; a later statement could point that name at something else. Tuples protect their contents, not the variable referencing them, so this does not achieve the stated goal.

  • ✗

    Declaring the name with the const keyword prevents reassignment

    Why it's wrong here

    Python has no const keyword; that identifier is not reserved and would simply be an ordinary name. Constants are a convention, not an enforced language feature. Writing const MAX_RETRIES = 5 would actually create a variable named const holding the integer 5, which is not the intended behaviour and would confuse readers.

About these practice questions

One of 482 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 and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Python Institute exam blueprint

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.