Python is the most common first-job language for AI, data and backend roles. These fresher-level questions cover the fundamentals interviewers actually ask, with answers you can learn from, plus a self-study path to get job-ready.
Python is an interpreted, dynamically-typed, high-level language. It is known for readable syntax, automatic memory management (garbage collection), a huge standard library, support for multiple paradigms (procedural, OOP, functional), and being cross-platform. Its large ecosystem (NumPy, pandas, Django, PyTorch) makes it popular for AI, data and web.
A list is mutable (you can add, remove or change items) and uses square brackets [], while a tuple is immutable (cannot be changed after creation) and uses parentheses (). Tuples are slightly faster and can be used as dictionary keys; lists are used when the collection needs to change.
"==" compares values (are the two objects equal?), while "is" compares identity (are they the same object in memory?). For example two lists with the same contents are == but not "is". Use "is" mainly for checking against None.
Immutable types cannot change after creation: int, float, str, tuple, bool, frozenset. Mutable types can change in place: list, dict, set. This matters for function arguments — passing a mutable object lets the function modify the caller’s data.
A dict is a hash-map of key→value pairs with average O(1) lookup, insertion and deletion. Use it when you need fast lookups by a unique key, such as counting items, caching, or representing records. Keys must be hashable (immutable).
A concise way to build a list from an iterable: [x*x for x in range(5)] gives [0,1,4,9,16]. You can add a condition: [x for x in nums if x % 2 == 0]. It is more readable and usually faster than an equivalent for-loop with append.
A shallow copy (copy.copy) copies the outer object but shares references to nested objects, so changing a nested item affects both. A deep copy (copy.deepcopy) recursively copies everything, so the copy is fully independent.
*args lets a function accept any number of positional arguments as a tuple; **kwargs accepts any number of keyword arguments as a dict. They are used to write flexible functions and to forward arguments to other functions.
A decorator is a function that takes another function and returns a modified version, used to add behaviour (logging, timing, auth) without changing the original code. It is applied with the @decorator syntax above a function definition.
The GIL is a mutex in CPython that allows only one thread to execute Python bytecode at a time. It simplifies memory management but means CPU-bound multithreading does not speed up; use multiprocessing for CPU-bound work and threads/async for I/O-bound work.
Use try/except to catch exceptions, optionally with else (runs if no exception) and finally (always runs, for cleanup). Catch specific exceptions rather than a bare except, and raise to propagate or re-raise errors.
Python 3 is the current version: print is a function, division of ints gives a float, strings are Unicode by default, and many libraries are 3-only. Python 2 reached end-of-life in 2020 and should not be used for new work.
Start with variables, numbers, strings, booleans and the four built-in collections: list, tuple, set, dict. Practise slicing, f-strings and basic input/output until they are automatic.
Learn if/elif/else, for and while loops, and functions: parameters, default arguments, *args/**kwargs, return values and scope. Write small programs (FizzBuzz, prime check, word count).
Understand classes, objects, __init__, instance vs class attributes, inheritance, and dunder methods (__str__, __eq__, __len__). Build a small class hierarchy.
Get comfortable with comprehensions, enumerate, zip, sorted with key, collections (Counter, defaultdict), itertools and the datetime, json and os modules.
Read/write files with context managers (with open), handle exceptions cleanly, and learn pip + venv to manage dependencies per project.
Build 2–3 small projects (a CLI tool, a simple API with FastAPI/Flask, a data script with pandas). Solve easy/medium problems daily to cement syntax and problem-solving.
Browse fresh internships and first jobs in Python and related fields.
Browse Internships