All questions
Showing of 52What is the difference between Python 2 and Python 3?
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:
Last attempt -
Python 3 introduced several breaking changes from Python 2:
- Print function:
print "hello"vsprint("hello") - Unicode strings: Default string type is Unicode in Python 3
- Integer division:
5/2returns2.5in Python 3,2in Python 2 - Range function:
range()returns an iterator in Python 3 - Input function:
raw_input()was renamed toinput()
Python 2 reached end-of-life in 2020, so Python 3 is the current standard.
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 ↓
What is PEP 8?
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:
Last attempt -
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
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 ↓
Explain Python's indentation and why it matters.
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:
Last attempt -
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.
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 ↓
What are Python keywords and identifiers?
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:
Last attempt -
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
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 ↓
Explain Python's built-in data types.
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:
Last attempt -
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
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 ↓
What is the difference between list and tuple?
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:
Last attempt -
| 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
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 ↓
Explain dictionary and its characteristics.
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:
Last attempt -
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"
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 ↓
Explain the different types of loops in Python.
What are `break`, `continue`, and `pass` statements?
Explain conditional statements in Python.
How do you define and call functions in Python?
Explain classes and objects in Python.
Explain exception handling in Python.
What is the difference between `except` and `finally`?
What is the difference between modules and packages?
Explain different ways to import modules.
What is the difference between `range()` and `xrange()`?
What are Python's built-in functions you should know?
Explain Python's `__name__ == "__main__"` idiom.
Explain Python's file handling modes.
What is the difference between `is` and `==` with examples?
Explain list comprehensions.
Explain different types of function arguments.
What is the difference between local and global variables?
Explain lambda functions.
What is inheritance and how is it implemented?
Explain method overriding and method overloading.
What are class variables vs instance variables?
Explain encapsulation and access modifiers.
How do you raise custom exceptions?
What is `__init__.py` and what is its purpose?
What are decorators and how do they work?
Explain generators and the `yield` keyword.
Explain context managers and the `with` statement.
Explain the `*args` and `**kwargs` concepts.
How does Python manage memory?
What is the difference between `del` and garbage collection?
How can you improve Python performance?
Explain the difference between multiprocessing and multithreading.
What is unit testing and how is it implemented in Python?
Explain debugging techniques in Python.
What is the difference between `assert` and exception handling?
What is the difference between shallow copy and deep copy?
What are dataclasses and how do they work?
Explain the `super()` function.
What are Python's special/magic methods?
What are Python virtual environments and why are they important?
What are metaclasses?
Explain Python's memory optimization techniques.
What is the Global Interpreter Lock (GIL)?
Explain the concept of monkey patching.
Explain Python's async/await and asynchronous programming.
This answer is part of Pro.
The full written answer, with the trade-offs and follow-ups an interviewer will probe.
No matches
Try a different filter or search term.
Python cheatsheet
- Python Fundamentals01
- Data Structures02
- Object-Oriented Programming03
- Functions & Decorators04
- Error Handling05
- Concurrency & Parallelism06
- Web Frameworks07
- RESTful APIs08
- Databases09
- Caching10
- Authentication & Security11
- Testing12
- + 7 more inside
- + 13 more inside
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.
MEAN
MongoDB, Express, Angular, Node.jsMERN
MongoDB, Express, React, Node.jsDjango
Python Full-Stack DevelopmentRuby on Rails
Convention over ConfigurationServerless on AWS
Serverless Architecture on AWSInterviewers also test these - they're common to every stack, whichever one you picked above.
Flutter Mobile
Flutter Cross-Platform Mobile DevelopmentInterviewers also test these - they're common to every stack, whichever one you picked above.
Spring Boot
Enterprise Java Development.NET
Microsoft EcosystemVue
Vue.js, Vite, TypeScript, Tailwind, Node.jsGo Backend
Golang, gRPC, PostgreSQL, Redis, RabbitMQInterviewers also test these - they're common to every stack, whichever one you picked above.
FastAPI
Python, FastAPI, SQLAlchemy, PostgreSQLReact Native
React, TypeScript, Redux, FirebaseiOS Native
Swift, SwiftUI, UIKit, FirebaseAndroid Native
Java, Jetpack Compose, FirebaseDevOps / Platform
Docker, Kubernetes, Terraform, CI/CDInterviewers also test these - they're common to every stack, whichever one you picked above.
AI Engineer
LLMs, RAG, Agents, EvalsAI-Powered Developer
Claude Code, Copilot, Agentic WorkflowsCore SWE Interview Prep
Data structures, algorithms, OS, concurrency, networking, gitInterviewers also test these - they're common to every stack, whichever one you picked above.
Interviewers also test these - they're common to every stack, whichever one you picked above.