LearnThatStack Ace your next interview
Backend Development

Python.

Start free Change topic Change
Practice · Questions

All questions

Showing of 52
Beginner 21
01

What is the difference between Python 2 and Python 3?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Python 3 introduced several breaking changes from Python 2:

  • Print function: print "hello" vs print("hello")
  • Unicode strings: Default string type is Unicode in Python 3
  • Integer division: 5/2 returns 2.5 in Python 3, 2 in Python 2
  • Range function: range() returns an iterator in Python 3
  • Input function: raw_input() was renamed to input()

Python 2 reached end-of-life in 2020, so Python 3 is the current standard.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

02

What is PEP 8?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

PEP 8 is the official style guide for Python code. It provides conventions for:

  • Indentation: Use 4 spaces per indentation level
  • Line length: Maximum 79 characters
  • Naming conventions: snake_case for variables, UPPER_CASE for constants
  • Import organization: Standard library, third-party, local imports
  • Whitespace: Proper spacing around operators and after commas
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

03

Explain Python's indentation and why it matters.

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Python uses indentation to define code blocks instead of braces {}. This enforces consistent code structure and improves readability.

if x > 0:
    print("Positive")  # 4 spaces indentation
    if x > 10:
        print("Greater than 10")  # 8 spaces indentation
else:
    print("Non-positive")

Incorrect indentation results in IndentationError.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

04

What are Python keywords and identifiers?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Keywords are reserved words with special meaning: if, else, for, while, def, class, import, etc.

Identifiers are names for variables, functions, classes, etc. Rules:

  • Start with letter or underscore
  • Contain letters, digits, underscores
  • Case-sensitive
  • Cannot be keywords
# Valid identifiers
variable_name = 10
_private_var = 20
ClassName = "example"

# Invalid identifiers
# 123variable = 10  # Cannot start with digit
# class = "test"    # Cannot use keyword
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

05

Explain Python's built-in data types.

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Python has several built-in data types:

Numeric: int, float, complex
Sequence: str, list, tuple
Set: set, frozenset
Mapping: dict
Boolean: bool
None: NoneType

integer = 42
floating = 3.14
string = "Hello"
boolean = True
none_value = None
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

06

What is the difference between list and tuple?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
List Tuple
Mutable (can be changed) Immutable (cannot be changed)
Uses square brackets [] Uses parentheses ()
Slower performance Faster performance
More memory usage Less memory usage
# List - mutable
my_list = [1, 2, 3]
my_list[0] = 10  # Works

# Tuple - immutable
my_tuple = (1, 2, 3)
# my_tuple[0] = 10  # TypeError
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

07

Explain dictionary and its characteristics.

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Dictionary is a mutable, unordered collection of key-value pairs. Keys must be immutable and unique.

student = {
    "name": "John",
    "age": 25,
    "grades": [85, 90, 78]
}

# Accessing values
print(student["name"])  # John
print(student.get("age"))  # 25

# Adding/updating
student["email"] = "john@email.com"
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

08

Explain the different types of loops in Python.

Part of Pro
09

What are `break`, `continue`, and `pass` statements?

Part of Pro
10

Explain conditional statements in Python.

Part of Pro
11

How do you define and call functions in Python?

Part of Pro
12

Explain classes and objects in Python.

Part of Pro
13

Explain exception handling in Python.

Part of Pro
14

What is the difference between `except` and `finally`?

Part of Pro
15

What is the difference between modules and packages?

Part of Pro
16

Explain different ways to import modules.

Part of Pro
17

What is the difference between `range()` and `xrange()`?

Part of Pro
18

What are Python's built-in functions you should know?

Part of Pro
19

Explain Python's `__name__ == "__main__"` idiom.

Part of Pro
20

Explain Python's file handling modes.

Part of Pro
21

What is the difference between `is` and `==` with examples?

Part of Pro
Intermediate 26
22

Explain list comprehensions.

Part of Pro
23

Explain different types of function arguments.

Part of Pro
24

What is the difference between local and global variables?

Part of Pro
25

Explain lambda functions.

Part of Pro
26

What is inheritance and how is it implemented?

Part of Pro
27

Explain method overriding and method overloading.

Part of Pro
28

What are class variables vs instance variables?

Part of Pro
29

Explain encapsulation and access modifiers.

Part of Pro
30

How do you raise custom exceptions?

Part of Pro
31

What is `__init__.py` and what is its purpose?

Part of Pro
32

What are decorators and how do they work?

Part of Pro
33

Explain generators and the `yield` keyword.

Part of Pro
34

Explain context managers and the `with` statement.

Part of Pro
35

Explain the `*args` and `**kwargs` concepts.

Part of Pro
36

How does Python manage memory?

Part of Pro
37

What is the difference between `del` and garbage collection?

Part of Pro
38

How can you improve Python performance?

Part of Pro
39

Explain the difference between multiprocessing and multithreading.

Part of Pro
40

What is unit testing and how is it implemented in Python?

Part of Pro
41

Explain debugging techniques in Python.

Part of Pro
42

What is the difference between `assert` and exception handling?

Part of Pro
43

What is the difference between shallow copy and deep copy?

Part of Pro
44

What are dataclasses and how do they work?

Part of Pro
45

Explain the `super()` function.

Part of Pro
46

What are Python's special/magic methods?

Part of Pro
47

What are Python virtual environments and why are they important?

Part of Pro
Expert 5
48

What are metaclasses?

Part of Pro
49

Explain Python's memory optimization techniques.

Part of Pro
50

What is the Global Interpreter Lock (GIL)?

Part of Pro
51

Explain the concept of monkey patching.

Part of Pro
52

Explain Python's async/await and asynchronous programming.

Part of Pro

No matches

Try a different filter or search term.

Know someone prepping for Python? Send them this set.
Pro · $10/mo

45 of 52 Python answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime

Change topic

Pick a different technology or stack. Your current topic stays put until you choose a new one.

Technologies
No technologies match “”.
Cross-cutting topics
No topics match “”.
By role
Stacks & frameworks

MEAN

MongoDB, Express, Angular, Node.js

MERN

MongoDB, Express, React, Node.js

LAMP

Linux, Apache, MySQL, PHP

Django

Python Full-Stack Development

Ruby on Rails

Convention over Configuration

Serverless on AWS

Serverless Architecture on AWS

Flutter Mobile

Flutter Cross-Platform Mobile Development

Spring Boot

Enterprise Java Development

.NET

Microsoft Ecosystem

Vue

Vue.js, Vite, TypeScript, Tailwind, Node.js

Go Backend

Golang, gRPC, PostgreSQL, Redis, RabbitMQ

FastAPI

Python, FastAPI, SQLAlchemy, PostgreSQL

React Native

React, TypeScript, Redux, Firebase

iOS Native

Swift, SwiftUI, UIKit, Firebase

Android Native

Java, Jetpack Compose, Firebase

DevOps / Platform

Docker, Kubernetes, Terraform, CI/CD

AI Engineer

LLMs, RAG, Agents, Evals

AI-Powered Developer

Claude Code, Copilot, Agentic Workflows

Core SWE Interview Prep

Data structures, algorithms, OS, concurrency, networking, git