InterviewStack.io LogoInterviewStack.io

Python Fundamentals and Core Syntax Questions

Comprehensive knowledge of core Python language features and syntax, including primitive and composite data types such as integer numbers, floating point numbers, strings, booleans, lists, dictionaries, sets, and tuples. Candidates should understand variable assignment and naming, operators for arithmetic, logical, and comparison operations, and control flow constructs including conditional statements and loops. Expect familiarity with function definition, invocation, parameter passing, return values, and scope rules, as well as common built in functions and idioms such as iteration utilities, list comprehensions, generator expressions, and basic functional utilities like map and filter. Candidates should demonstrate error and exception handling techniques and best practices for writing readable and maintainable code with modularization and clear naming. Practical skills include file input and output, working with common data formats such as comma separated values and JavaScript Object Notation, selecting appropriate data structures with attention to performance and memory characteristics, and applying memory efficient patterns for processing large data sets using iterators and generators. Familiarity with the standard library and common utilities for parsing and transforming data, and the ability to write small code snippets to solve algorithmic and data manipulation tasks, are expected.

EasyTechnical
82 practiced
Explain Python function parameter types: positional, keyword, default values, *args, and **kwargs. Provide a function signature example that demonstrates each kind, and describe typical usage patterns in data processing pipelines.
HardTechnical
60 practiced
Implement a JSON validator in Python using only the standard library that validates each input JSON object against a simple schema like: {'id': int, 'name': str, 'tags': list}. The validator should yield human-readable path-specific error messages (e.g., 'user.address.zip: expected int, got str').
HardTechnical
61 practiced
Implement a robust CSV reader in Python that handles varying column counts per row, different delimiters, quoted fields, and malformed lines. The reader should yield a dict per row keyed by header names when a header exists and report parsing errors with line numbers without crashing the whole pipeline.
MediumTechnical
83 practiced
Explain Python scoping rules (LEGB: Local, Enclosing, Global, Built-in). Provide a concrete example showing a closure capturing a loop variable incorrectly when creating functions in a loop, and demonstrate two ways to fix the problem.
MediumTechnical
79 practiced
Write Python code to normalize and clean a column of free-form text values: lowercasing, trimming whitespace, removing punctuation, and collapsing multiple spaces. The function should accept an iterator of strings and yield cleaned strings lazily so it can be used in streaming pipelines.

Unlock Full Question Bank

Get access to hundreds of Python Fundamentals and Core Syntax interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.