PGoCareerGoCareer prep tools
Home
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

Python · Theory

List vs Dictionary in Python

← All stacks

Theory

39/268

List vs Dictionary in Python

List is position-based. names[0] is the first student. Dict is key-based. marks["Asha"] is 90. Use a list when order matters and you walk items in a row. Use a dict when you look up by a label — name, roll, email — not by seat number.

You can store dicts inside a list (rows of students) or lists inside a dict (hobbies per name). Index vs key is the clean comparison line. Pick dict when “find Asha’s marks” should not scan the whole list.

List vs Dictionary in Python — output — Asha then 90. List by position, dict by name.

Diagram
{ "Asha": 90, "Ravi": 85 }
         │           │
        key        value
Exam tip

When would you pick dict over list?

Example

# List vs dict
names = ["Asha", "Ravi"]
marks = {"Asha": 90, "Ravi": 85}
print(names[0])
print(marks["Asha"])

List vs Dictionary in Python — output: Asha then 90. List by position, dict by name.

Short notes

  • DefList: index
  • RuleDict: key
  • RememberSequence vs map

Questions

1

Explain List vs Dictionary as if you are teaching a junior — definition, then one tiny script.

2

What does the example print, and why?

3

What mistake do freshers make with List vs Dictionary?

Previous← Python Dictionary MethodsNextList vs Set vs Tuple vs Dictionary →
P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.