Courseiva

PCEP Computer Programming and Python Fundamentals Practice Question

According to PEP 8, which of the following is the recommended way to name a constant representing the maximum number of retries?

⚠ Common exam trap

The PCEP exam often tests the distinction between variable naming conventions (snake_case for variables vs. UPPER_CASE for constants) and the rule that identifiers cannot start with a digit, leading candidates to confuse camelCase or invalid names with PEP 8 recommendations.

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

✓

MAX_RETRIES

PEP 8 (Python Enhancement Proposal 8) recommends that constants be named using uppercase letters with underscores separating words, i.e., `MAX_RETRIES`. This convention distinguishes constants from regular variables, which use lowercase with underscores, and helps improve code readability and maintainability.

Answer analysis

Option-by-option breakdown

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

  • ✓

    MAX_RETRIES

    Why this is correct

    PEP 8 specifies that constants use all-uppercase letters with underscores separating words, so MAX_RETRIES matches the required naming convention for a maximum retries constant. Lowercase or camelCase forms are reserved for variables, functions and classes.

  • ✗

    max_retries

    Why it's wrong here

    PEP 8 reserves lowercase with underscores for variables and functions; constants use all uppercase letters, so MAX_RETRIES is required. The lowercase form is tempting because it is valid Python and matches ordinary variable naming, which is exactly when it would be the right style.

  • ✗

    1st_retry_limit

    Why it's wrong here

    Cannot start with a digit.

  • ✗

    maxRetries

    Why it's wrong here

    CamelCase is for classes, not constants.

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