Python Variables Quiz

Master Quiz: Python Naming Conventions

🎩 Python Naming Conventions

Prove your DevSecOps expertise! Answer 20 questions to earn your rank.
Green = Correct, Red = Incorrect.

BeginnerVariables

What is the recommended style for variable names in Python?

IntermediateClass Naming

When should you strictly use PascalCase?

BeginnerStandards

What is PEP 8?

IntermediateConstants

How should you name a constant value like PI?

ArchitectAutomation

Which tool automatically checks your code for style violations?

AdvancedAnti-Patterns

Why avoid Hungarian Notation (e.g., strName)?

BeginnerDescriptive Naming

Which variable name is preferred?

AdvancedExceptions

When is it acceptable to use CamelCase (e.g., setUp)?

BeginnerRefactoring

Refactor calculate_Salary to Python style:

IntermediateSingle Letter Vars

When are single-letter vars (i, x) okay?

AdvancedPrivate Variables

What does a single underscore prefix mean (e.g., _data)?

ArchitectName Mangling

What happens with double underscores (e.g., __password)?

IntermediateShadowing

Why is list = [1, 2, 3] a bad variable name?

IntermediateModules

What is the convention for Module names (file names)?

BeginnerReadability

Which single letter variable should be avoided due to font issues?

AdvancedWhitespace

Which assignment follows PEP 8 whitespace rules?

ArchitectError Naming

How should you name a custom Exception class?

IntermediateArguments

What is the correct style for Function Arguments?

AdvancedLine Length

According to strict PEP 8, what is the max line length?

ArchitectImports

Which import style is preferred?

Scroll to Top